function makePngTransparent()
{
	//style="width:100px;height:132px;filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'/img/img_soldout.png\', sizingMethod=\'scale\');"
	var img_array = document.getElementsByTagName("img");
	var img_array_transparent = new Array();
	
	for(var i=0; i < img_array.length; i++)
	{
		if(img_array[i].className == "png_transparent")
		{
			img_src = img_array[i].src;
			img_array[i].src = "";
			img_array[i].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+img_src+"', sizingMethod='scale')";
		}
	}
}
//======================================================================================================================
function tab_change(tab_id,tab_class)
{
	if(document.getElementById(tab_id))
	{
		var tab = document.getElementById(tab_id);
		var tab_left = document.getElementById(tab_id+"_left");
		var tab_bg = document.getElementById(tab_id+"_bg");
		var tab_right = document.getElementById(tab_id+"_right");
		tab.className = tab_class;
		tab_left.className = tab_class+"_left";
		tab_bg.className = tab_class+"_bg";
		tab_right.className = tab_class+"_right";
	}
}
function load_common_functions()
{
	try
	{
		order_quick_getShows(0);
		show_calendar.PaintDates(show_calendar);
		ShowEventsInCalendar();
		ShowSelectedEventsInCalendar();
	}
	catch(e)
	{
	 
	}
}
//======================================================================================================================
function form_member_login()
{
	var ajax_member_login_connection = new XHConn();
	var ajax_member_login_requestInProcess = false;
	var ajax_member_login_response;
	
	var block_member_username = document.getElementById("block_member_username");
	var block_member_password = document.getElementById("block_member_password");
	var block_member_logged = document.getElementById("block_member_logged");
	var block_member_notlogged = document.getElementById("block_member_notlogged");
	var block_member_fullname = document.getElementById("block_member_fullname");
	
	if(block_member_username.value.length == 0)
	{
		alert('!שדה "שם משתמש" ריק');
		block_member_username.focus();
		return false;
	}
	if(block_member_password.value.length == 0)
	{
		alert('!שדה "סיסמא" ריק');
		block_member_password.focus();
		return false;
	}
	function ajax_member_login_sendRequest()
	{
		if( !ajax_member_login_requestInProcess )
		{
			document.body.style.cursor="wait";
			ajax_member_login_requestInProcess = true;
			ajax_path = "member_login.php";
			ajax_member_login_connection.connect(ajax_path, "POST", "member_username="+ block_member_username.value+"&member_password="+block_member_password.value+"", ajax_member_login_getResponse, false);
		}
	}
	function ajax_member_login_getResponse(ajax_member_login_response)
	{
		if(ajax_member_login_response.readyState == 4)
		{
			response_array = new Array();
			response_array = ajax_member_login_response.responseText.split("|");
			response_statusCode = response_array[0];
			response_errorCode = response_array[1];
			member_fullname = response_array[2];
			if( response_statusCode == "1" )
			{
				switch(response_errorCode)
				{
					case("0"):
					{
						block_member_username.value = "";
						block_member_password.value = "";
						block_member_fullname.innerHTML = member_fullname;
						block_member_logged.style.display = "";
						block_member_notlogged.style.display = "none";
						document.location = document.location.href;
						break;
					}
					case("1"):
					{
						block_member_username.value = "";
						block_member_password.value = "";
						alert("פרטים שגויים");
						break;
					}
					case("2"):
					{
						block_member_username.value = "";
						block_member_password.value = "";
						alert("המבצע פג תוקף");
						break;
					}
					default:break;
				}
			}
			else
			{
				block_member_username.value = "";
					block_member_password.value = "";
				alert("פרטים שגויים");
			}
		}
		document.body.style.cursor="default";
		ajax_member_login_requestInProcess = false;
		return void(0);
	}
	ajax_member_login_sendRequest();
}
function form_member_logout()
{
	var ajax_member_logout_connection = new XHConn();
	var ajax_member_logout_requestInProcess = false;
	var ajax_member_logout_response;
	
	var block_member_username = document.getElementById("block_member_username");
	var block_member_password = document.getElementById("block_member_password");
	var block_member_logged = document.getElementById("block_member_logged");
	var block_member_notlogged = document.getElementById("block_member_notlogged");
	var block_member_fullname = document.getElementById("block_member_fullname");

	function ajax_member_logout_sendRequest()
	{
		if( !ajax_member_logout_requestInProcess )
		{
			document.body.style.cursor="wait";
			ajax_member_login_requestInProcess = true;
			ajax_path = "member_logout.php";
			ajax_member_logout_connection.connect(ajax_path, "POST", "",ajax_member_logout_getResponse, false);
		}
	}
	function ajax_member_logout_getResponse(ajax_member_logout_response)
	{
		if(ajax_member_logout_response.readyState == 4)
		{
			loggedout = ajax_member_logout_response.responseText;
			if( loggedout == "true" )
			{
				block_member_username.value = "";
				block_member_password.value = "";
				block_member_fullname.innerHTML = "";
				block_member_logged.style.display = "none";
				block_member_notlogged.style.display = "";
				document.location = document.location.href;
			}
		}
		document.body.style.cursor="default";
		ajax_member_logout_requestInProcess = false;
		return void(0);
	}
	ajax_member_logout_sendRequest();
}
//======================================================================================================================
function form_remindpassword_submit()
{
	member_email = document.getElementById("member_email");
	//
	if(member_email.value.length == 0)
	{
		alert('!שדה "דואר אלקטרוני" ריק');
		member_email.focus();
		return(false);
	}
	document.getElementById("form_remindpassword").submit();
}
//======================================================================================================================
function map_show(div_id)
{
	var div = document.getElementById(div_id);
	if( div.style.display != "" )
	div.style.display = "";
	else
	div.style.display = "none";
}
//======================================================================================================================
function InitPage()
{
	if ( parseInt(navigator.appVersion) > 3 )
	{
		if ( navigator.appName=="Netscape" )
		{
			mainX = window.innerWidth / 2;
			mainY = window.innerHeight / 2;
		}
		if ( navigator.appName.indexOf("Microsoft") != -1 )
		{
			mainX = document.body.offsetWidth / 2;
			mainY = document.body.offsetHeight / 2;
		}
	}
}
/*
//==[ POPUP ]===========================================================================================================
function popup(popup_id)
{
	var popup_container = document.getElementById(popup_id);
	//
	if( popup_container.style.display != "" )
	{
		popup_fader();
		popup_container.style.display = "";
		popup_container_width = popup_container.clientWidth;
		popup_container_height = popup_container.clientHeight;
		
		popup_container_x = mainX - (popup_container_width / 2);
		popup_container_y = mainY - (popup_container_height / 2);
		
		popup_container.style.left = popup_container_x+"px";
		popup_container.style.top = popup_container_y+"px";
	}
	else
	{
		popup_fader();
		popup_container.style.display = "none";
	}
}
function popup_fader()
{
	var popup_fader = document.getElementById(popup_fader_id);
	//
	if( popup_fader.style.display != "" )
	popup_fader.style.display = "";
	else
	popup_fader.style.display = "none";
}
*/
//==[ MINIPOPUP ]=======================================================================================================
function minipopup(minipopup_id,minipopup_str,minipopup_x,minipopup_y)
{
	var minipopup_container = document.getElementById(minipopup_id);
	var minipopup_text = document.getElementById(minipopup_id+"_text");
	var minipopup_text2 = document.getElementById(minipopup_id+"_text2");
	//
	if( minipopup_container.style.display != "" )
	{
		minipopup_text.innerHTML = minipopup_str;
		minipopup_text2.innerHTML = minipopup_str;
		//
		minipopup_container.style.display = "";
		//
		minipopup_width = minipopup_text.clientWidth;
		minipopup_height = minipopup_text.clientHeight;
		//
		minipopup_x_new = minipopup_x + ( minipopup_width / 2 ) + 34 + 12;
		minipopup_y_new = minipopup_y - minipopup_height - ( 26 + 40 );
		//
		minipopup_container.style.left = minipopup_x_new+"px";
		minipopup_container.style.top = minipopup_y_new+"px";
		//
		//alert("Client Height:   " + minipopup_text.offsetHeight);
	}
	else
	{
		minipopup_text.innerHTML = "";
		minipopup_text2.innerHTML = "";
		minipopup_container.style.display = "none";
	}
}
//==[ GALLERY ]=========================================================================================================
function gallery_image_change(operator,gallery_image_container_id,gallery_image_array)
{
	var gallery_image_container = document.getElementById(gallery_image_container_id);
	var gallery_image_number = document.getElementById(gallery_image_container_id+"_number");
	
	if(operator == "+")
	gallery_image_corrent++;
	else
	gallery_image_corrent--;
	//
	if(  gallery_image_corrent == -1 )
	gallery_image_corrent = (gallery_image_sum-1);
	//
	if(  gallery_image_corrent > (gallery_image_sum-1) )
	gallery_image_corrent = 0;
	//
	gallery_image_container.src = gallery_image_array[gallery_image_corrent];
	gallery_image_container.onload = function(){ popup_reload('popup_show_gallery'); }
	gallery_image_number.innerHTML = (gallery_image_corrent+1)+"/"+gallery_image_sum;
	
	
	
}
//
function gallery_image_init(gallery_image_container_id,gallery_image_array)
{
	var gallery_image_container = document.getElementById(gallery_image_container_id);
	var gallery_image_number = document.getElementById(gallery_image_container_id+"_number");
	//
	gallery_image_container.src = gallery_image_array[gallery_image_corrent];
	gallery_image_number.innerHTML = (gallery_image_corrent+1)+"/"+gallery_image_sum
}
//
//==[ FORM - CONTACT - SUMBIT ]=========================================================================================

//==[ FORM - SEARCH - SUMBIT ]==========================================================================================
function form_search_submit()
{
	document.getElementById("form_search").submit();
}
//
//==[ HIDE AND UNHIDE ELEMENT ]=========================================================================================
function hide(element_id)
{
	var element = document.getElementById(element_id);
	//
	if( element.style.display != "" )
	element.style.display = "";
	else
	element.style.display = "none";
}
