﻿/*
function OpenPostingPickerPopUp()
{
	winId = window.open("<%=Request.ApplicationPath%>/Controls/PostingPickerPopUp.aspx","PostingPicker","height=600,width=500,left=100,top=100,scrollbars=1;status=0,menubar=0");
}
*/
function openIPIX(IPIXName)
{

	var sPath="/Rashat/Popups/IPIX.aspx?sPicSrc="+IPIXName;
	winId = window.open(sPath,"IPIX","height=500,width=700,scrollbars=0;status=0,menubar=0");
}
//this function called from themplates
//UserCode = 
//			1. Main - call openMap function with no params. do not send UserCulture
//			2. Name of map. send UserCulture.
//			3. code location like: t-g-3. do not send UserCulture
//UserCulture = heb or eng
function setMap(UserCode, UserCulture)
{
	UserCode = UserCode.replace(' ','');
	
	if(UserCode.toUpperCase == "MAIN")
	{
		openMap();
	}
	else if(UserCode.substr(0,1) == "#")//find sign '#' in position 0
	{	
		openFlow(UserCode.substr(1),UserCulture);
	}	
	else if(UserCode.indexOf("mitkan") != -1)
	{
		openParkingLots(UserCode, UserCulture);
	}
	else if(UserCode.indexOf("-")!= -1 || UserCode.indexOf("_")!= -1)//find sign '-' or '_' => code location
	{
		openElement(UserCode,UserCulture);
	}
	else //user pass name of map
	{
		openMap(UserCode,UserCulture);
	}	
}

function openFlow (flowId,lang)
{
	mapWin = window.open("/Rashat/map.aspx?mapId=Terminal3&flowId=" + flowId + "&lang=" + lang ,"mapWin","width=780, height=537");
	mapWin.focus();
}

function openMap(mapId,lang)
{
	if(lang==undefined){
		lang="heb";
	}
	if(mapId==undefined){
		mapId="Israel";
	}
	mapWin = window.open("/Rashat/map.aspx?mapId="+mapId+"&lang="+lang,"mapWin","width=780, height=537");
	mapWin.focus();
}
function openElement(markElement,lang)
{
	mapWin = window.open("/Rashat/map.aspx?elementId="+markElement+"&lang="+lang,"mapWin","width=780, height=537");
	mapWin.focus();
}

function openParkingLots(UserCode,lang)
{
	var splitChar = "#";
	var arr	= UserCode.split(splitChar);
	if (arr.length == 2)
	{
		mapWin = window.open("/Rashat/map.aspx?mapView="+arr[0]+"&elementId="+arr[1]+"&lang="+lang,"mapWin","width=780, height=537");
		mapWin.focus();
	}
}

//FLIGHTS 
function ChkAndSetImgSize(img, maxWidth, maxHeight)
{
	if(img.width > maxWidth) img.width = maxWidth;
	if(img.height > maxHeight) img.height = maxHeight;
}

//Get a referece to tr and highlights all its tds(class hilite)
function SetHighLight(tr)
{
	tr.runtimeStyle.backgroundColor = "#0087E1";
	tr.runtimeStyle.color = "#FFFFFF";
}
//Get a referece to tr and set all its td's classes to arial12
function SetDeHighLight(tr)
{
	tr.runtimeStyle.backgroundColor = "";
	tr.runtimeStyle.color = "#333333"
	
}

function HideLastTableColumn(table)
{
	var i = 0;
	for(i=0 ; i < table.rows.length ; i++)
	{
		table.rows[i].cells[table.rows[i].cells.length - 1].style.display=none;
	}
}
//END FLIGHTS


function newImage(arg) 
{
	if (document.images) 
	{
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}
	
function checkKey(objToClick)
{
	if(event.keyCode==13)
	{
		try
		{
			var o;
			o=document.getElementById(objToClick);
			if(typeof(o)=="object")
				o.click();
		}
		catch(e)
		{
			//error
		}
		finally
		{
			event.returnValue=false;
			event.cancelBubble=true;
		}
	}
}
document.attachEvent("onkeypress",checkKey);