function AbsoluteCenter(obj, objWidth, bnrWidth)
{	
	var leftPos = 0;
	var curWidth = parseInt(screen.width);
	 
	leftPos = ((curWidth- objWidth)/2);
	 
	if(bnrWidth >= leftPos && curWidth != 800)
		leftPos = bnrWidth + 50;
			
	 
	obj.style.marginLeft = leftPos+"px";
	obj.style.display = "block";
}

function EqualHeights(objFrom,ObjTo,ExtraHeight)
{
	var FromHeight = objFrom.offsetHeight;
	var ToHeight = ObjTo.offsetHeight;
	
	if(parseInt(FromHeight) <  parseInt(ToHeight))
		return;
		
	ObjTo.style.height = (parseInt(FromHeight)+parseInt(ExtraHeight))+"px";
}

function EqualHeightsForSearch(objFrom,ObjTo,ObjSpace,ExtraHeight)
{
	var FromHeight = objFrom.offsetHeight;
	var ToHeight = ObjTo.offsetHeight;

	if(parseInt(FromHeight) <  parseInt(ToHeight))
		return;
		
	var diff = parseInt(FromHeight)- parseInt(ToHeight);
	$(ObjSpace).height(diff + ExtraHeight);
}


function CheckCategoryFreetextSearch(txtSearchName,isPaying,hdnCatID,hdnFreeText)
{	
	var q=document.getElementById(txtSearchName).value;
	var CatID = ""; 
	var FreeText = "";
	var isCatID = false;	 
	if(q.length)
		for(i=0;i<CatNames.length;i++)	
			if(CatNames[i]==q)
			{ 
					CatID = CatIDs[i];	
					isCatID = true;
			}		

	 ///alert(pageurl)	
	 if(!isCatID) FreeText = q;
	 
	 document.getElementById(hdnCatID).value = CatID;
	 document.getElementById(hdnFreeText).value = FreeText;
}

function SetTblHeight()
{	
	if (Number(document.all["tblleft"].clientHeight)< Number(document.all["tblRight"].clientHeight)+75)
	document.all["tblspace"].style.height=Number(document.all["tblRight"].clientHeight)-Number(document.all["tblleft"].clientHeight)+75;
} 

function PreLoadInfoArr()
{
	 InfoArr = new Array();
      InfoArr[0]= "";
      InfoArr[1]= "קובץ קורות החיים שלך ישלח אוטומטית לכל משרה קיימת ולכל משרה חדשה שתכנס למערכת.";
      InfoArr[2]= "כאן עליך לצרף קובץ קוח אנונימי ללא פרטיך המזהים. קורות החיים האנונימיים ישלחו אוטומטית לכל משרה קיימת ולכל משרה חדשה שתכנס למערכת. מעסיק שירצה ליצור קשר יבקש את אישורך לחשיפת פרטיך בפניו.";
      InfoArr[3]= "המערכת לא תשלח את קורות החיים שלך למעסיקים, אלא לאחר קבלת אישור ממך."
}

//Get Value of Combo Option And Plant His txt In Span
function GetCmbTextByHisValue(value,cmbName,spnName)
{
	var CmbObj = document.getElementById(cmbName);
	var i;
	var Len = parseInt(CmbObj.options.length);
	
	for(i=0;i<Len;i++)
		if(CmbObj.options[i].value == value)
			break;
	//i-1 is the index of the value parameter 		
	var Value = CmbObj.options[i].innerText;
	document.getElementById(spnName).innerHTML = Value
	
	CmbObj.options[i].selected = true;
}

// ------ Roby : New Cv Panel : 39 Project --------- //
function ShowMatchDetails(JobID,HFResumeID,ev)
{
	Locate(ev);
	var QRST = "CVsListActions.aspx?Action=ShowMatchDetails&DivParent=DivParent&JobID="+JobID+"&HFResumeID="+HFResumeID;
	parent.document.getElementById("ifrmMatch").src = QRST;
}

function Locate(e){

	//Get Navigator Type
	var Nav = navigator.appName;
	if (Nav == "Microsoft Internet Explorer") Nav = "IE";
		
	var posx=0,posy=0;
	if(e==null) e=window.event;

	posx = e.clientX+document.body.scrollLeft;
	posy = e.clientY+document.body.scrollTop;
			
	var ExtraPosY = (Nav == "IE")?ExtraPosY=360:ExtraPosY=395
	var ExtraPosX = (Nav == "IE")?ExtraPosX=55:ExtraPosX=50
	
	parent.document.getElementById("DivParent").style.top = (posy + ExtraPosY)+"px";
	parent.document.getElementById("DivParent").style.left = (posx + ExtraPosX)+"px";
}

function SetTabsAmounts(s0,s1,s2,s3,s4)
{
	window.parent.document.getElementById("spanCard100").innerHTML = s0;
	window.parent.document.getElementById("spanCard101").innerHTML = s1;
	window.parent.document.getElementById("spanCard102").innerHTML = s2;
	window.parent.document.getElementById("spanCard103").innerHTML = s3;
	window.parent.document.getElementById("spanCard104").innerHTML = s4;
}

function TransferCV(cmbName)
{
	var Nstatus=document.getElementById(cmbName).options[document.getElementById(cmbName).selectedIndex].value;
	// -1 = no action!!	
	if(Nstatus == -1){
		displayAlertMsg('שים לב, יש לבחור יעד העברה !');
		return;
	}		
	// build an array seperated by ',' char for all selected chkbox values (UserJobIDs)	
	var values = "",i; 
	var cnt = window.parent.ifrm.document.getElementById("txtCvsCount").value;
	for(i=1;i<=parseInt(cnt);i++){
		//get all values selected in the Child frame
		var obj = window.parent.ifrm.document.getElementById("chkGroup"+i);
		if(obj.checked) values+=(obj.value)+",";				
	}
	// build query string for the change status action page 
	var QSTR;
	if(values == "") 
	{
		displayAlertMsg('שים לב, יש לסמן את המועמדים שברצונך לבצע עליהם את הפעולה !');
		return;
	}
	//cut extra ','
	values = values.substring(0,(values.length-1));
	//activate action 
	QSTR = "CVsListActions.aspx?Action=ChangeStatus&values="+values+"&NewStatus="+Nstatus;
	
	$.ajax({
	type: "GET",
	url: QSTR,
	data: "",
	success: function(res)
	{
		parent.frames['ifrm'].window.location.reload(true);
		this.focus();
	}
	});
}


function displayAlertMsg(msg)
{
	//Open Alert Box with 1 Option: Return To Page.
	$('#spnAlertMsg').html(msg);
	$('#aLeftMenu').attr('href','javascript:$.unblockUI();');
	$('#aLeftMenu').html('סגור');
	$.blockUI.defaults.pageMessage = $('#divAlert').html();
	$.extend($.blockUI.defaults.pageMessageCSS, { border: '1px solid #d2d2d2',width:'300px',direction:'rtl' }); 			
	$.blockUI();
}

//pop up & pop up from mail
function TransferCVPopUp(cmbName,value,fromPopUp)
{ 
      //Get The Selected Value
      var Nstatus=document.getElementById(cmbName).options[document.getElementById(cmbName).selectedIndex].value;	
     // -1 = no action!!	
      if(Nstatus == -1)
      {
		displayAlertMsg('שים לב, יש לבחור בתיקייה אליה אתה מעוניין להעביר את המועמד !');
		return;
	  }
	  
	   var QSTR = "/Employer/CVsListActions.aspx?Action=ChangeStatus&values="+value+"&NewStatus="+Nstatus;
	   
		$.ajax({
		type: "GET",
		url: QSTR,
		data: "",
		success: function(res)
		{
			opener.location.reload();
			this.focus();    
		}
		});
 
	///document.getElementById('frmMailPopUp').src = QSTR;
	//refresh panel behind
}


function FillfrmMail(obj)
{
	var TabIndex = window.parent.ifrm.document.getElementById("txtPageStatus").value;
	var SelectedIndex = obj.options[obj.selectedIndex].value;
	if(SelectedIndex == -1){
		displayAlertMsg('שים לב, יש לבחור את סוג המייל שברצונך לשלוח !');
		return;
	}	
	var Length = parent.ifrm.document.getElementById('txtCvsCount').value;

	var ids = "",i,thisObj = null;
	for(i=1;i<=Length;i++)
	{
		thisObj = window.parent.ifrm.document.getElementById("chkGroup"+i);
		if(thisObj.checked)
			ids+=thisObj.value + ",";
	}
	
	if(ids == "") 
	{
		displayAlertMsg('שים לב, יש לסמן את המועמדים שברצונך לבצע עליהם את הפעולה !');
		return;
	}
	var QSTR = "ChildMailstyle.aspx?act=ShowMailMsgStyle&Ids="+ids+"&SelectedIndex="+SelectedIndex+"&TabIndex="+TabIndex;
	document.getElementById('frmMail').src = QSTR;	
}

function FillfrmMailPopUp(obj,UserJobID,DivParentName,TabIndex)
{
	//Mail Type
	var SelectedIndex = obj.options[obj.selectedIndex].value;
	if(SelectedIndex == -1) 
	{	
		displayAlertMsg('שים לב, יש לבחור את סוג המייל שברצונך לשלוח !');
		return;
	}
				
	var QSTR= "/Employer/ChildMailstyle.aspx?act=ShowMailMsgStyle&Ids="+UserJobID+"&SelectedIndex="+SelectedIndex+"&TabIndex="+TabIndex+"&frmName=frmMailPopUp&DivParentName="+DivParentName;
	document.getElementById('frmMailPopUp').src = QSTR;	
}

function CloseParentDiv(DivName)
{	 
	document.getElementById(DivName).innerHTML = "";
	document.getElementById(DivName).style.display = "none";
}

function SendMsgMail(SelectedIndex,ids,txtAreaName,TabIndex,DivParentName,frmName)
{
	var Content = document.getElementById(txtAreaName).value;
				
	var QRST = "/Employer/ChildMailstyle.aspx?act=SendMsgMail&SelectedIndex="+SelectedIndex+"&ids="+ids+"&Content="+Content+"&TabIndex="+TabIndex+"&DivParentName="+DivParentName;
	//Fill The Iframe In Order To Fill The Div Without Rendering All Page	
	document.getElementById(frmName).src = QRST;
}

function SaveRemark(From,JobID,CompanyID,UserID,TabIndex,CvType)
{
	var Title = document.getElementById("txtNewTitle").value;
	var RemarkBody = document.getElementById("txtNewRemark").value;
	if(trim(Title) == '')
	{
		displayAlertMsg('לא נרשמה כותרת!');
		return;
	}
	if(trim(RemarkBody).length > 150)
	{
		displayAlertMsg('הערה ארוכה. עד 150 תוים!');
		return;
	}
	var isGlobal = true;
	var QSTR = From+"?action=NewRemark&JobID="+JobID+"&CompanyID="+CompanyID+"&UserID="+UserID+"&Title="+Title+"&Body="+RemarkBody+"&isGlobal="+isGlobal+"&TabIndex="+TabIndex+"&CvType="+CvType;
	document.location.href = QSTR;
}


function UpdateRemark(From,id,JobID,CompanyID,UserID,TabIndex,CvType)
{
	var Title = document.getElementById("txtTitle"+id).value;
	var RemarkBody = document.getElementById("txtRemark"+id).value;
	var QSTR = From+"?action=Update&RemarkID="+id+"&JobID="+JobID+"&CompanyID="+CompanyID+"&UserID="+UserID+"&Title="+Title+"&Body="+RemarkBody+"&TabIndex="+TabIndex+"&CvType="+CvType;
	document.location.href = QSTR;
}


function deleteRemarkByID(From,id,JobID,CompanyID,UserID,TabIndex,CvType)
{
	var QSTR = From+"?action=Delete&RemarkID="+id+"&JobID="+JobID+"&CompanyID="+CompanyID+"&UserID="+UserID+"&TabIndex="+TabIndex+"&CvType="+CvType;
	document.location.href = QSTR;
}

function editRemarkByID(From,id,JobID,CompanyID,UserID,TabIndex,CvType)
{
	var QSTR = From+"?action=Edit&RemarkID="+id+"&JobID="+JobID+"&CompanyID="+CompanyID+"&UserID="+UserID+"&TabIndex="+TabIndex+"&CvType="+CvType;
	document.location.href = QSTR;
}
// --------------------- End ------------------------ //

function SetExposeMail(MatchID,UserID,CompanyID)
{
	var QRST = "ChildMailstyle.aspx?act=ShowMailExposeStyle&MatchID="+MatchID+"&UserID="+UserID+"&CompanyID="+CompanyID;
	//alert(QRST);	
	parent.document.getElementById('ifrmActions').src = QRST;
}

function SendExposeMail(MatchID,UserID,CompanyID,txtAreaName)
{
	var Content = document.getElementById(txtAreaName).value;
	var QRST = "ChildMailstyle.aspx?act=SendExposeMail&MatchID="+MatchID+"&UserID="+UserID+"&CompanyID="+CompanyID+"&Content="+Content;
	//alert(QRST);
	parent.document.getElementById('ifrmActions').src = QRST;
}


function ActivateDragDrop()
{
	var dragapproved=false;
	var z,x,y;
	
	document.onmousedown=drags;
    document.onmouseup=new Function("dragapproved=false");
}

function move()
{
	if (event.button==1 && dragapproved)
	{
		Elem.style.pixelLeft=leftPixel+event.clientX-x
		Elem.style.pixelTop=TopPixel+event.clientY-y
		return false
	}
}

function drags()
{
	if (!document.all)
		return;
		
	if (event.srcElement.className=="drag")
	{
		dragapproved=true
		Elem=event.srcElement
		leftPixel=Elem.style.pixelLeft
		TopPixel=Elem.style.pixelTop
		x=event.clientX
		y=event.clientY
		document.onmousemove=move
	}
}


function closeFloatDiv(DivName)
{
	document.getElementById(DivName).innerHTML = '';
	document.getElementById(DivName).style.display = "none";
}

function PlusMinus(imgName,trName)
{
	//alert("ImageName="+imgName+" ; TrName"+trName )
	var State = document.getElementById(trName).style.display;
	if(State == "none")
	{
		document.getElementById(imgName).src = "/images/Employer/Minus.jpg";
		document.getElementById(trName).style.display = "block";
	}
	else
	{
		document.getElementById(imgName).src =	"/images/Employer/Plus.jpg"	;
		document.getElementById(trName).style.display = "none";
	}
}

function PlusMinus2(imgName,trName)
{
	//alert("ImageName="+imgName+" ; TrName"+trName )
	var State = document.getElementById(trName).style.display;
	if(State == "none")
	{
		document.getElementById(imgName).src = "/images/PopUpCV/btnMin2.gif";
		document.getElementById(trName).style.display = "block";
	}
	else
	{
		document.getElementById(imgName).src =	"/images/PopUpCV/btnPlus2.gif"	;
		document.getElementById(trName).style.display = "none";
	}
}

function TransferHF(cmbName)
{
	//Get The Selected Value
	var Nstatus=document.getElementById(cmbName).options[document.getElementById(cmbName).selectedIndex].value;
	//-1 is option "בחר" - no action!!
	if(Nstatus != -1)
	{
		// var to hold all id's selected(checkboxes)
		var values = ""; 
		// cnt is an hidden type holds the amount of rows 
		var cnt = window.parent.ifrm.document.getElementById("txtCvsCount").value;
		var i;
		for(i=1;i<=parseInt(cnt);i++)
		{
			//get all values selected in the Child frame
			var obj = window.parent.ifrm.document.getElementById("chkGroup"+i);
			if(obj.checked)
				values+=(obj.value)+",";				
		}
		var QSTR
		if(values != "")
		{
			//get the suitable page status
			var thisPageStatus = window.parent.ifrm.document.getElementById("txtPageStatus").value;
			//Loose The Extra Char ','
			values = values.substring(0,(values.length-1));
			
			//Build The Query string
		    QSTR = "CVsHFList.aspx?action=ChangeStatus&values="+values+"&NewStatus="+Nstatus+"&Status="+thisPageStatus;
		    document.getElementById("ifrm").src = QSTR
		    //alert(QSTR) 
		}		
	}
}



function ShowWin(winN)
{
	//alert(winN)
	var liveHelpDialogFeature="width=500,height=500,left=100,top=100,resizable=no,scrollbars=no,menubar=no,toolbar=no,status=no;";
	MyWin=window.open(winN,"MyWin", liveHelpDialogFeature);
	MyWin.focus();
}
		
function ShowWinInWantedSize(winN,width,height)
{
	//alert(winN)
	var liveHelpDialogFeature="width="+width+",height="+height+",left=100,top=100,resizable=no,scrollbars=no,menubar=no,toolbar=no,status=no;";
	MyWin=window.open(winN,"MyWin", liveHelpDialogFeature);
	MyWin.focus();
}
 

function ShowWin(winN)
		{
			//alert(winN)
			var liveHelpDialogFeature="width=500,height=500,left=100,top=100,resizable=no,scrollbars=no,menubar=no,toolbar=no,status=no;";
			MyWin=window.open(winN,"MyWin", liveHelpDialogFeature);
			MyWin.focus();
		}
function CheckIfThereAreBids()
{
	var Res = AllJobs.PPCV.PPCVJobBids.CheckIfThereAreBids(RequestQueryString("JobID"));
	
	if(Res.value!="yes")
	{
		document.getElementById("divNoBids").style.display="block";
		return false;
	}
	else
		return true;
}

function ContinueWithOutPPCV()
{
	document.location = "PPCVJobBids.aspx?JobID=" + RequestQueryString("JobID") + "&CancelBids=1";
}

function ContinueWithPPCV()
{
	document.getElementById("divNoBids").style.display = "none";
}



function SearchJobs(cmbName)
{
	 
    var RequestStr=new String();
    RequestStr="/SearchResultsGuest.aspx?page=1&position=";
    RequestStr+=document.getElementById(cmbName).options[document.getElementById(cmbName).selectedIndex].value;
    
    location = RequestStr;
}
		


function PrintOrRedirect()
{
	if(PrintImg)
	{
		document.getElementById('ImageButton1').style.display="none";
		window.print();
		document.getElementById('ImageButton1').style.display="block";
		document.getElementById('ImageButton1').src="../images/PPCV/btnNewBack.jpg"
		PrintImg=false;
	}
	else document.location.href="/Employer/JobsPanel/Default.aspx";
}


function CheckDDL(val,args)
{
	args.IsValid=(args.Value!=-1);
}

function CheckIfPositionEmpty(val,args)
{
	if(document.getElementById("SimpleSelectorJobPositions_listNames2").value=="")
		args.IsValid=false;
	else
		args.IsValid=true;
}

function CheckAgr(sender, args)
{
	if(document.getElementById('checkBoxAgrea').checked == false)
		args.IsValid = false;
}

function SetVAT(vatValue, txtName)
{
	var amount = new String();
	amount = document.getElementById(txtName).value;
	if(amount=="" || amount.match(/^([0-9]*|\d*\.\d{1}?\d*)$/g)==null || parseFloat(amount)==0)
	{
		document.getElementById('ltrVAT').innerHTML = "";
		return;
	}
	
	var VAT = vatValue;
	VAT = parseFloat(VAT)/100 + 1;
	var amountWithoutVAT = parseFloat(amount)*parseFloat(VAT); 
	document.getElementById('ltrVAT').innerHTML = amountWithoutVAT.toFixed(2) + " (כולל מע''מ) ";
}


function CheckCupon()
{
	var patern=/^\w{8}-\w{4}-\w{4}-\w{4}-\w{12}$/
	
	var obj = new String();
	obj = document.getElementById('txtKupon').value;
	
	if(obj.match(patern)==null)
	{
		document.getElementById('spnKupon').style.visibility="visible";
		return false;
	}
	else
	{
		document.getElementById('spnKupon').style.visibility="hidden";
	}
}

function SetNoAmountLimit()
{
	document.getElementById("txtAmountLimit").className = "TxtBoxDisable";
	document.getElementById("txtAmountLimit").disabled = true;
	document.getElementById("tdAmountLimit").className = "lblDisable";
}

function SetAmountLimit()
{
	document.getElementById("txtAmountLimit").className = "TxtBoxEnable";
	document.getElementById("txtAmountLimit").disabled = false;
	document.getElementById("tdAmountLimit").className = "lblEnable";
}

function CheckAmount(sender, args)
{
	if(document.getElementById("radioNoAmountLimit").checked == true) return;
	
	if(document.getElementById('txtAmountLimit').value == "")
	{
		document.getElementById('CustomValidatorAmount').innerHTML = "שדה חובה";
		args.IsValid = false;
	}
	else
	{
		var str = new String();
		str = document.getElementById('txtAmountLimit').value;
		if(str.match(/^([0-9]*|\d*\.\d{1}?\d*)$/g)==null || parseFloat(str)==0)
		{
			document.getElementById('CustomValidatorAmount').innerHTML = "סכום לא תקין";
			args.IsValid = false;
		}		
	}
}







function JobsByCategory()
{
	if(document.getElementById('cmb').options[document.getElementById('cmb').selectedIndex].value != "-1")
		location = "EmployerJobsPanel.aspx?JobCategory=" + document.getElementById('cmb').options[document.getElementById('cmb').selectedIndex].value;
}

function FindJobByTitle()
{
	if(document.getElementById('txtJobTitle').value == "")
		return;

	location = "EmployerJobsPanel.aspx?JobTitle=" + document.getElementById('txtJobTitle').value;
}



// get query string paramter and return the value
function RequestQueryString(sParamName,isParentRequest)
{
	var sHref="";
	var arrHref;
	var nParamStartPos=0, nParamEndPos=0;
	var sParamValue='';
	 
	sHref = typeof isParentRequest != 'undefined' ? sHref = parent.document.location.href  : sHref = document.location.href;	
		 
	arrHref = sHref.split("?");
	// return empty string if the query string not exsits
	if (arrHref.length <= 1) 
		return(sParamValue);
	sParamName += '=';
	nParamStartPos = arrHref[1].indexOf(sParamName);
	// return empty string if the requested parameter is not exsits
	if(nParamStartPos == -1)	
		return(sParamValue);
	nParamStartPos += sParamName.toString().length;
	nParamEndPos = arrHref[1].indexOf("&", nParamStartPos);
	if(nParamStartPos == nParamEndPos)
		return '';
		
	if(nParamEndPos > -1 && nParamEndPos > nParamStartPos)
		sParamValue=arrHref[1].slice(nParamStartPos,nParamEndPos);
	else
		sParamValue=arrHref[1].slice(nParamStartPos);

	return(sParamValue);
}

 


function FillCitiesForThisRegion()
{
	//Get Selected Region Value
	var SelectedRegionIndex = document.getElementById("JobRegionddl").selectedIndex;
	var SelectedRegionValue = document.getElementById("JobRegionddl").options[SelectedRegionIndex].value;

	if(parseInt(SelectedRegionValue )== -1)
		return;

	var i;
	var SelectedRegionArrayIndex;
	
	//Get Selected Region Index in regions Array 
	for(i=0;i<regionsID.length;i++)
		if(regionsID[i] == SelectedRegionValue)
		{
			SelectedRegionArrayIndex = i;
			break;
		}
	
	//Clear Cities Drop Down
	while(document.getElementById("cmbCities").options.length > 1)
			document.getElementById("cmbCities").remove(1);
	
	//Set Cities Drop Down By Region		
	for(i=0;i<cities[SelectedRegionArrayIndex].length;i++)
	{
		/*
		var opt;
		opt = document.createElement("OPTION");
		opt.text = cities[SelectedRegionArrayIndex][i];
		opt.value = citiesID[SelectedRegionArrayIndex][i];
		document.getElementById("cmbCities").add(opt);
		*/
		document.getElementById("cmbCities").options[document.getElementById("cmbCities").options.length] = 
				new Option(cities[SelectedRegionArrayIndex][i] + ' והסביבה ', citiesID[SelectedRegionArrayIndex][i]);
	}
	
}

function SetSelectedCityOption()
{
	 
	var i;
	for(i=0;i<document.getElementById("cmbCities").options.length;i++)
		if(document.getElementById("cmbCities").options[i].value==
					document.getElementById("txtSelectedCityID").value)
		{
			document.getElementById("cmbCities").options[i].selected = true;
			break;
		}
}

function SetSelectedCityID()
{
	//Get Selected City Value
	var SelectedCityIndex = document.getElementById("cmbCities").selectedIndex;
	var SelectedCityValue = document.getElementById("cmbCities").options[SelectedCityIndex].value;
	
	document.getElementById("txtSelectedCityID").value = SelectedCityValue;
	//alert(document.getElementById("txtSelectedCityID").value )
}





function DisplayBNR(filter)
{
//alert(filter)
document.write( "\<SCRIPT"  );
document.write( "    language=JavaScript src='"+BnrServer+"abm.aspx?" + filter +"' type='text/javascript'" );
document.write( "\>" );
document.write( "\</SCRIPT\>" );
//alert(filter)
}


/*
function GetTheOptimizeLocation()
{
		var Res = screen.width+"X"+screen.height;
		//var Res = screen.width+"X"+screen.height+";";
		
		//alert(Res.length)
		//Res=Res.substring(0,Res.indexOf(';'));
		//alert(Res);
					
		switch(Res)
		{
			case "1024X768":if(navigator.appName=="Microsoft Internet Explorer")
							{
								document.getElementById("divSelector").style.left="410"+"px";
								document.getElementById("divSelector").style.height="310"+"px";
							}	
							else document.getElementById("divSelector").style.left="420";			
							break;
			case "1152X864":if(navigator.appName=="Microsoft Internet Explorer")
							{
								document.getElementById("divSelector").style.left="470"+"px";
								document.getElementById("divSelector").style.height="310"+"px";
							}
							else document.getElementById("divSelector").style.left="480";		
				break;
			case "800X600":if(navigator.appName=="Microsoft Internet Explorer")
							{
								document.getElementById("divSelector").style.left="300"+"px";	
								document.getElementById("divSelector").style.height="310"+"px";
							}
							else document.getElementById("divSelector").style.left="305";
							break;
			default:if(navigator.appName=="Microsoft Internet Explorer")
							{
								document.getElementById("divSelector").style.left="410"+"px";
								document.getElementById("divSelector").style.height="310"+"px";
							}	
							else document.getElementById("divSelector").style.left="420";			
							break;	
		}
}

*/
function UrlEncode(sStr)
{
	var sReturn=''
	for (var i=0;i<sStr.length;i++)
	{
		var iUni=sStr.charCodeAt(i);
		if(iUni>=1488 && iUni<=1514)
		{
			var iAsc=iUni-1264 ;
			sReturn+=escape(String.fromCharCode(iAsc));
		}else if(iUni==32) sReturn += escape('+');
		else if(iUni==43) sReturn += '%2b';
		else	sReturn+=escape(sStr.charAt(i));
	}
	return sReturn;
} 

function Div(Div1)
{

this.onerror=function (sError,sURL,iLine){	return ClassException('Div',sError,sURL,iLine); }

var oIframePrint;
var oDiv=Div1;
var iStartPos;
var iStartPosLeft;
var iStartPosLeftWidth;
var bSameLocation;
var iSizeStep;
var iMaxSize;
var bNetScape = navigator.appName.toLowerCase()=='netscape' ;
var iStartHeight
var iOpacityLevel;

iStartHeight=oDiv.nodeName=='IFRAME'?oDiv.height:iStartHeight=oDiv.offsetHeight;
this.getAllChild=getAllChild;
oDiv.getAllChild=getAllChild;
oDiv.iStartPos=iStartPos;
this.iStartPos=iStartPos;
oDiv.Print=Print;
this.Print=Print;
oDiv.ChangeState=ChangeState;
this.ChangeState=ChangeState;
oDiv.foo=foo;
this.foo=foo;
oDiv.Open=StateOpen;
this.Open=StateOpen;
oDiv.Close=StateClose;
this.Close=StateClose;
oDiv.Clear=Clear;
this.Clear=Clear;
oDiv.reLocate=LocateInit;
this.reLocate=LocateInit;
oDiv.ChangeSize=ChangeSizeInit;
this.ChangeSize=ChangeSizeInit;
oDiv.ChangeSizeClose=ChangeSizeCloseInit;
this.ChangeSizeClose=ChangeSizeCloseInit;
oDiv.RemoveHTMLNode=RemoveNode;
this.RemoveHTMLNode=RemoveNode;
oDiv.ObjectResize=ObjectResize;
this.ObjectResize=ObjectResize;
oDiv.ObjectResizeHeight=ObjectResizeHeight;
this.ObjectResizeHeight=ObjectResizeHeight;
oDiv.ObjectResizeWidth=ObjectResizeWidth;
this.ObjectResizeWidth=ObjectResizeWidth;
oDiv.Opacity=Opacity;
this.Opacity=Opacity;
oDiv.FadeIn=FadeInInit;
this.FadeIn=FadeInInit;
oDiv.FadeOut=FadeOutInit;
this.FadeOut=FadeOutInit;
oDiv.ShowAndFade=ShowAndFade;
this.ShowAndFade=ShowAndFade;
oDiv.getWidth=getWidth;
this.getWidth=getWidth;
oDiv.getHeight=getHeight;
this.getHeight=getHeight;
oDiv.PositionBest=PositionBest;
this.PositionBest=PositionBest;
oDiv.LocationBest=LocationBest;
this.LocationBest=LocationBest;
oDiv.getElementX=getElementX;
this.getElementX=getElementX;
oDiv.getElementY=getElementY;
this.getElementY=getElementY;
oDiv.PlaceOver=PlaceOverInit;
this.PlaceOver=PlaceOverInit;
oDiv.isOpen=isOpen;
this.isOpen=isOpen;

	 
	function getAllChildRecurse(sTag,oPtr,oArr)
	{
		for (var i=0;i<oPtr.length;i++)
		{
			if(sTag==oPtr[i].tagName)
				oArr[oArr.length]=oPtr[i];
			getAllChildRecurse(sTag,oPtr[i],oArr);
		}
	}
	function getAllChild(sTag)
	{
		var oArr=new Array();
		var oPtr=oDiv.parentNode.childNodes;
		getAllChildRecurse(sTag, oPtr,oArr);		
		return oArr;
	}
	function LocationBest(oInput)
	{
		var iTop=0;
		var iLeft=60;
		var oParent=oInput;

		for (var oPtr=oParent;oPtr;oPtr=oPtr.parentNode)
		{
			if(oPtr.tagName!='TR')
			{
				if( oPtr.offsetLeft )	iLeft += oPtr.offsetLeft;
				if( oPtr.offsetTop  )	iTop  += oPtr.offsetTop;
			}
		}
		oDiv.style.left=iLeft - oInput.getWidth()/2;
		oDiv.style.top=iTop + new Div(oParent).getHeight();
	}

	function getScreenWidth()
	{
		return document.body.offsetWidth;	
	}
	function PlaceOver(oDivToPlace,iTableWidth)
	{
		oDivToPlace.style.top=getElementY();
		var iX = getElementX();
		var iExtra = getScreenWidth() - iX >0 ? (getScreenWidth()-iTableWidth)/2 : 0 ;
		oDivToPlace.style.left = iX + iExtra;
		var fnResize=window.onresize;
	}

	function PlaceOverInit(oDivToPlace,iTableWidth)
	{
		PlaceOver(oDivToPlace,iTableWidth);
		var fnResize=window.onresize;
		window.onresize=function (){
			if (fnResize)
				fnResize();
			PlaceOver(oDivToPlace,iTableWidth);
		}
	}
	
	function getElementX()
	{	
		return oDiv.scrollLeft + oDiv.offsetLeft;
	}
	
	function getElementY()
	{	
		return oDiv.scrollTop + oDiv.offsetTop;
	}
	
	function PositionBest(e)
	{
			var x=getX(e);
			var y=getY(e);
			var iHeight=getHeight();
			var iWidth=getWidth();
			var iWidth2=iWidth / 2;
			var iPageWidth=getPageWidth() ;
			var iLeftScroll=document.body.scrollLeft;
			var	iLeftArrow=0;
			var oTDTop		= document.getElementById('tdToolTipTop');
			var oTDBottom	= document.getElementById('tdToolTipBottom');
			var iImgWidth	= 25
			if( y > document.body.scrollTop + iHeight )
			{
				y += -1 * iHeight - 20 
				if (oTDTop && oTDBottom)
				{
					new Div(oTDTop).Close()
					new Div(oTDBottom).Open()
				}
			}else{
				y += 20;
				if (oTDTop && oTDBottom)
				{
					new Div(oTDTop).Open()
					new Div(oTDBottom).Close()
				}
			}
			oDiv.style.top=y;
				
			if (bNetScape)
				oDiv.style.right=iPageWidth-x;
			else
			{
				if (x + iWidth2 > iPageWidth + iLeftScroll )
				{
					x= iPageWidth  - iWidth;
					iLeftArrow =  getX()-iLeftScroll- x - iImgWidth;
				}else if( x - iWidth2  < iLeftScroll)
				{
					x= 0; 
					
					iLeftArrow = getX()-iLeftScroll- x - iImgWidth;
				}else{
						x -= iLeftScroll + iWidth2 ;
						iLeftArrow=iWidth2 - iImgWidth;
				}
				
				if (iLeftArrow>0 && oTDTop && oTDBottom)
				{
					oTDTop.style.paddingLeft=iLeftArrow;
					oTDBottom.style.paddingLeft=iLeftArrow;
				}
				oDiv.style.left=x;
			}

	}
	
	function ShowAndFade(oDiv1)
	{
		StateOpen()
		oDiv1?oDiv1.onmouseout=FadeOutInit:oDiv.onmouseout=FadeOutInit;
	}
	
	function FadeInInit()
	{
		iOpacityLevel=0;
		FadeIn()
	}
	
	function FadeIn()
	{
		iOpacityLevel++;
		Opacity(iOpacityLevel);
		if (iOpacityLevel<=100)
			setTimeout(FadeIn,20);
	}

	function FadeOutInit()
	{
		iOpacityLevel=100;
		FadeOut()
	}

	function FadeOut()
	{
		iOpacityLevel-=5;
		Opacity(iOpacityLevel)
		if(iOpacityLevel>=0)
			setTimeout(FadeOut,100)
		else{
			StateClose(); 
			Opacity(100);
		}
		
	}

	function Opacity(iOpacity)
	{
		oDiv.style.filter='alpha(opacity=' + iOpacity + ', style=0)';
	}

	function getPageWidth()
	{
		return document.body.clientWidth;
	}
	
	function getPageHeight()
	{
		return document.body.clientHeight;
	}

	function getX(e)
	{
		var x;
		x=!bNetScape ? window.event.x :e.pageX;
		x+=document.body.scrollLeft;
		return x;
	}
	
	function getY(e)
	{
		return bNetScape ? e.pageY : window.event.y + document.body.scrollTop ;
	}

	function getWidth()
	{
	
	 
		return oDiv.offsetWidth;
	}

	function getHeight()
	{
		return oDiv.offsetHeight;
	}

	function ObjectResizeHeight(oHTML)
	{
		oDiv.style.height	=oHTML.offsetHeight;
	}

	function ObjectResizeWidth(oHTML)
	{
		oDiv.style.width	=oHTML.offsetWidth;
	}

	function ObjectResize(oHTML,iOpacity)
	{
		ObjectResizeHeight(oHTML);
		ObjectResizeWidth(oHTML);

		if (iOpacity)
			Opacity(iOpacity);
	}
	
	function RemoveNode()
	{
		oDiv.parentNode.removeChild(oDiv);
	}

	function ChangeSizeInit(Step,MaxSize)
	{
		iSizeStep	= Step;
		iMaxSize	= MaxSize;
		clearInterval (oDiv.Interval);
		oDiv.Interval=setInterval(ChangeSize,10);
	}
	
	function Clear()
	{
		oDiv.innerHTML='';
	}
	
	function ChangeSize()
	{
		var iHeight=oDiv.offsetHeight;
		iHeight < iMaxSize?	oDiv.style.height = iHeight + iSizeStep : clearInterval (oDiv.Interval);
	}
	
	function ChangeSizeCloseInit(Step)
	{
		iSizeStep	= Step;
		clearInterval (oDiv.Interval);
		oDiv.Interval=setInterval(ChangeSizeClose,10);
	}

	function ChangeSizeClose()
	{
		var iHeight=oDiv.offsetHeight;
		iHeight > iStartHeight?	oDiv.style.height = iHeight - iSizeStep : clearInterval (oDiv.Interval);
	}
	
	function Print()
	{
	 
		var oArr=document.getElementsByTagName('link')

		oIframePrint=document.createElement('<IFRAME id="ifrmPrint" height="0" width="0">');
		var sHTML = 
		'<html dir=rtl>'+
			'<head>'+
				'<title>Print Frame</title>';

		for (var i=0;i<oArr.length;i++)
			if(oArr[i].rel=='stylesheet')
				sHTML+=
				'<LINK REL="stylesheet" TYPE="text/css" HREF="' + oArr[i].href + '">';
		sHTML+=
			'</head>'+
			'<body>' + 
				oDiv.innerHTML+
			'<body>'+
		'</html>';
		var body = document.getElementsByTagName('body')[0]; 
		body.appendChild(oIframePrint);
		//document.body.appendChild(oIframePrint);
		var oIFr=document.frames['ifrmPrint']
		
		oIFr.document.writeln(sHTML);
		oIFr.focus();
		setTimeout(PrintFin,200);
		
	}
	
	function PrintFin()
	{
		print();
		document.body.removeChild(oIframePrint);
	}
	
	function StateOpen()
	{
		if (!isOpen())
		{
			if (bNetScape)
			{
				oDiv.style.display='inline';
			}
			oDiv.style.display='';
		}
	}
	
	function StateClose()
	{
		oDiv.style.display='none';
	}
	
	function isOpen()
	{
		return oDiv.style.display!='none';
	}
	
	function ChangeState()
	{
		isOpen() ? StateClose() : StateOpen();
	}
	
	function foo(){iStartPos=220}
	
	function LocateInit(iY,bSamePlace)
	{
		//iStartPos=220
		if(iStartPos!=220)
		
		{!iY? iStartPos=oDiv.offsetTop : iStartPos=iY;}
		var fnOnScroll=window.onscroll;
		window.onscroll=function (){
			if (fnOnScroll) fnOnScroll();
			reLocate();
		}
		bSameLocation=bSamePlace;
		iStartPosLeft=oDiv.offsetLeft;
		iStartPosLeftWidth	= oDiv.offsetWidth;
		reLocate ();
	}
	
	function reLocate()
	{
		var oDivStyle = oDiv.style
		var iDestPos
		if (bSameLocation)
			iDestPos = document.body.scrollTop + iStartPos;
		else if (iStartPos > document.body.scrollTop )
			iDestPos = iStartPos;
		else
			iDestPos = document.body.scrollTop;

		//oDivStyle.left		= iStartPosLeftWidth + iStartPosLeft;
		oDivStyle.top		= iDestPos;
		//alert (iDestPos)	
	}
		
	if (bNetScape)
	{
		oDiv.insertAdjacentHTML=function(stam,str)
		{	
			var r = document.createRange();
			r.setStartBefore(document.body);
			var node = r.createContextualFragment(str);
			oDiv.appendChild(node);	
		}
		
		function allIn(sID,oCurrNode)
		{
			for(var i=0;i<oCurrNode.length;i++)
			{
				if(oCurrNode[i].id==sID)
					return oCurrNode[i];
				else
				{
					var returned=allIn(sID,oCurrNode[i].childNodes);
					if (returned!=null)
						return returned;
				}
			}
		}

		function allFirst(sID)
		{
			var oCurrNode=oDiv.childNodes;
			return allIn(sID,oCurrNode);
		}
		this.all=allFirst
		oDiv.all=allFirst;
	}
 
 }
		function GetCheckBoxes(getAll)
        {
            var obj,val;
            var ids="";
            //obj = document.getElementsByName("jobCb");
            obj=document.forms[0].getElementsByTagName("input");
            for (var i=1; i< obj.length; i++)
            {
                if (obj.item(i).type=='checkbox')
                 if(getAll==true || obj.item(i).checked==true)
					{
						val = parseInt(obj.item(i).value);
						if (val!=NaN && val>0)
							ids += obj.item(i).value + ",";
					}
            }
            
            if (ids.length > 0)
				ids = ids.substring(0, ids.length-1);
            
            return ids;
        }
        
        function PrintJobs(printAll)
        {
			//var jobids = GetCheckBoxes(printAll);
//			var jobids = GetCheckCookies(false);
			var jobids = getCookie("jobCHK");
			if (jobids != null && jobids.length>1)
				window.open('PrintResults.aspx?JobID=' + jobids,'printWindow','menubar=yes,status=yes,scrollbars=yes,location=no','');
			else
				if (printAll==false)
					alert("לא נבחרו משרות");
        }
        
        function SendCVJobs()
        {
			//var jobids = GetCheckBoxes(false);
//			var jobids = GetCheckCookies(false);
			var jobids = getCookie("jobCHK");
		 
			 
			if (jobids != null && jobids.length>1)
				{
					var split_jobids  = jobids.split(",");						 
					var href = window.location.href
					for(t=0;t<split_jobids.length;t++)
						{
							VelingoCollectorForSingleJob(href,split_jobids[t])
							//alert(split_jobids[t])
						}
					window.location.href = "UserSelectedJobs.aspx?JobID=" + jobids;
				}
				
			else
				alert("לא נבחרו משרות");
        }
        
        function MoveJobsToMyList()
        {
			//var jobids = GetCheckBoxes(false);
//			var jobids = GetCheckCookies(false);			
			var jobids = getCookie("jobCHK");
			if (jobids != null && jobids.length>1)
				window.open('UserAddSelectedJobsToList.aspx?JobID=' + jobids,'addjobs','menubar=yes,status=yes,scrollbars=yes,location=no','');
			else
				alert("לא נבחרו משרות");
        }
		function fncSearchKeyDown(query,textin)
		{
				var key = window.event.keyCode;
				if (key == 13)
				{
					alert("fncSearchKeyDown:" + key + " query="+ query + " textin=" + textin);
					fncSearchInResults(query,textin);
				}
		}
		function fncSearchInResults(query,textin)
		{
			var rv;
			var textinPos;
			textinPos = query.indexOf("&textin=");
			if(textinPos != -1)
					rv = query.substr(0,textinPos) + "&textin=" +  (document.getElementById(textin).value);
			else	
				rv = query + "&textin=" + (document.getElementById(textin).value);
			var p1 = rv.indexOf("?");
			var rv1 = rv.substr(p1+1);
			window.location.href = "SearchDispatcherNew.aspx?" + rv1;	
		} 
		function nofollow(href)
		{			
			VelingoCollectorForSingleJob(href,RequestQuery("JobID",href))
			window.location.href = href;
		}
		
		function VelingoCollectorForSingleJob(href,JobID)
		{
			// Velingo agrigation, check If there JobID And (Category Or Keyword in the url)
			try
			{
			
				 
				if(JobID!='')
				{
					var phrases = ""
					var categoryID;
					var position = RequestQueryString("position"); 
					var freetext = RequestQueryString("freetxt");
					
					//check if position contains &
					if(position.indexOf('&')!=-1)
					{
						position="";
					}
					
					//check if we have category Or freetext search
					if(freetext.length==0 && position.length==0) 
					{
						return ;
					}
					
					//If we have free text then this the main phares for velingo otherwise catgoryname
					if(freetext.length>3) 
					{
						phrases = freetext;
					}
					else
					{
					
						var split_position  = position.split(",");
						 
						if(split_position.length>1)
						{     
						var CategoryName=new String();
						for(j=0;j<split_position.length;j++)
						{
							categoryID =split_position[j];
							
							for(i=0;i<CategoryIDs.length;i++)
								{
									if(categoryID==CategoryIDs[i])
									{
										CategoryName+=CategoryNames[i].replace('/',' ').replace(',',' ') + ","			
									}		
								}
							}
							CategoryName=CategoryName.substring(0,CategoryName.length-1);
							phrases  =  CategoryName;
						}	
						if(split_position.length==1)
						{
							categoryID =split_position[0];
							for(i=0;i<CategoryIDs.length;i++)
								{
									if(categoryID==CategoryIDs[i])
									{
										 
										var CategoryName=CategoryNames[i].replace('/',' ');
										CategoryName=CategoryName.replace(',',' ');			 			 
										//CategoryName=CategoryName.replace('+',' ');	
										phrases=CategoryName
									}
								}
						}
					}
					
				}
				
				//check if there phrases then send it to velingo servers
				if(phrases!='')
				{
					var VelingoURL = 'http://194.90.130.131/ReverseSearch/Service?event=1&license=5dc17d2f4e72eda51f68:2&url=' + JobID + '&query=' + phrases  ;				
					myImage = new Image() 
					myImage.src = VelingoURL;
				}
				//document.write(myImage.src)
			
			}
			catch(err)
			{
				//alert(err.description)
			}
			 
		}
		
	function RequestQuery(sParamName,sHref){	 
	var arrHref;
	var nParamStartPos=0, nParamEndPos=0;
	var sParamValue='';		
	arrHref = sHref.split("?");
	// return empty string if the query string not exsits
	if (arrHref.length <= 1) 
		return(sParamValue);
	sParamName += '=';
	nParamStartPos = arrHref[1].indexOf(sParamName);
	// return empty string if the requested parameter is not exsits
	if(nParamStartPos == -1)	
		return(sParamValue);
	nParamStartPos += sParamName.toString().length;
	nParamEndPos = arrHref[1].indexOf("&", nParamStartPos);
	if(nParamEndPos > -1 && nParamEndPos > nParamStartPos)
		sParamValue=arrHref[1].slice(nParamStartPos,nParamEndPos);
	else
		sParamValue=arrHref[1].slice(nParamStartPos);

	return(sParamValue);
}

		function removeElement(arr, val) 
		{
		   var temp = new Array();
			for(var i=0; i<arr.length; i++) {
				if (arr[i] != val) temp[temp.length] = arr[i];
			}
			arr.length = 0;
			for(var i=0; i<temp.length; i++) {
				arr[arr.length] = temp[i];
			}
		}
/*
		function viewArray(arr)
		{
			var arrstr = "";
			for(var i=0; i<arr.length; i++)
				arrstr += arr[i] + ","
			alert(arrstr);	
		}
*/
		function elementExists(arr, val) 
		{
			var exists = false;
			for(var i=0; i<arr.length; i++) {
			if (arr[i] == val) {
				exists = true;
				break;
				}
			}
			return exists;
		}

	function toggleCHK(obj)
	{
		var curCookie = obj.name.substr(7);
		if (obj.checked)
			addCookie(curCookie);
		else
			deleteCookie("jobCHK",curCookie , '/');
	}

	function setCHK (objID)
	{
	 var el = document.getElementById(objID);
     el.checked = getCookieElement(objID) ;
	}
	function getCookieElement(obj)
	{
		var dc = getCookie("jobCHK");
		if (dc != null)
		{
			var dcArray = dc.split(",");
			return elementExists(dcArray,obj.substr(7));
		}
		return false;	
	}  	
	function GetCheckCookies(getAll)
	{
		var tempJobId = "";
		var dc = getCookie("jobCHK");
		var dcArray = dc.split(";");
		for(var i=1; i<dcArray.length; i++) {
//				if (dcArray[i].substr(0,8)  == ' jobCHK_')	
					tempJobId +=  (dcArray[i]) + ",";
			}
	

//	tempJobId =	tempJobId.replace(/ jobCHK_/gi,"");
//	tempJobId =	tempJobId.replace(/=true/gi,"");
	tempJobId = tempJobId.substr(0,tempJobId.length-1);
	return tempJobId;
	}

function ClearCheckCookies()
{
	var dc = getCookie("jobCHK");
	if (dc != null)
	{
		var dcArray = dc.split(",");
		for(var i=1; i<dcArray.length; i++) {
			deleteCookie("jobCHK",dcArray[i],'/');
		}
	}
}
function addCookie(value)
{
	var dc = getCookie("jobCHK");
	if (dc != null)
	{
		var dcArray = dc.split(",");
		if (!elementExists(dcArray,value))
			dc += ("," + value);
	}
	else
		dc = value;	
	setCookie("jobCHK",dc,"/");
}	
	
function setCookie(name, value, path, expires , domain, secure) {
	var curCookie = name + '=' + escape(value) +
		((expires) ? '; expires=' + expires.toGMTString() : '') +
		((path) ? '; path=' + path : '') +
		((domain) ? '; domain=' + domain : '') +
		((secure) ? '; secure' : '');
	document.cookie = curCookie;
}
function getCookie(name) {
	var dc = document.cookie;	  
	var prefix = name + '=';
	var begin = dc.indexOf('; ' + prefix);
	if (begin == -1) {
		begin = dc.indexOf(prefix);
		if (begin != 0) return null;
	} else
		begin += 2;
	var end = document.cookie.indexOf(';', begin);
	if (end == -1)
		end = dc.length;
	return unescape(dc.substring(begin + prefix.length, end));
}

function deleteCookie( cookiename,elementname, path, domain ) {
	var dc =getCookie( cookiename );
	if (dc != null)
	{
		var dcArray = dc.split(",");
		removeElement(dcArray,elementname);
		dc = dcArray.join(",");
		setCookie(cookiename,dc,"/");
//			document.cookie = cookiename + "=" +
//			( ( path ) ? ";path=" + path : "") +
//			( ( domain ) ? ";domain=" + domain : "" ) +
//			";expires=Thu, 01-Jan-1970 00:00:01 GMT";
	}
}

//Tell EmployerCVsPanel.aspx what tab is open
function SetPageStatus()
{
	var status = RequestQueryString("Status");
	parent.document.getElementById("hdnStatus").value = status;
}

function WindowOpenTopCenter(winN,width,height)
{
	var Left =  parseInt(screen.width)/2 - parseInt(width)/2;
	var scroll = (screen.width == "800")? "yes":"no";
	var liveHelpDialogFeature="width="+width+",height="+height+",left="+Left+",top=0,resizable=no,scrollbars="+scroll+",menubar=no,toolbar=no,status=no;";
	MyWin=window.open(winN,"MyWin", liveHelpDialogFeature);
	MyWin.focus();
}

//Enter Key Handler
function FireDefaultButton(event, target) 
{
	if ((event.keyCode == 13 || event.which == 13) && !(event.srcElement && (event.srcElement.tagName.toLowerCase() == 'textarea'))) 
	{
		var defaultButton = $('input:image[@id$="'+ target +'"]');
		if (defaultButton && typeof(defaultButton.click) != 'undefined') 
		{
			defaultButton.click();
			event.cancelBubble = true;
			if (event.stopPropagation) event.stopPropagation();
			return false;
		}
	}
	return true;
}

