//reloads the window if Nav4 resized----------------------------------------------------------
function MM_reloadPage(init) {  
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//--------------------------------------------------------------------------------------------

//Popup Win-----------------------------------------------------------------------------------
function OpnPopWin(theURL,winNam,winPro) { 
  window.open(theURL,winNam,winPro);
}
//--------------------------------------------------------------------------------------------

//Add to favorite-----------------------------------------------------------------------------
function add2fav(webUrl, webNam){
	
	window.external.AddFavorite( webUrl, webNam)
}
//--------------------------------------------------------------------------------------------


//Section NAvigation--------------------------------------------------------------------------
function MM_setTextOfLayer(objName,x,newText) { //v4.01
  if ((obj=MM_findObj(objName))!=null) with (obj)
    if (document.layers) {document.write(unescape(newText)); document.close();}
    else innerHTML = unescape(newText);
}
//--------------------------------------------------------------------------------------------

//Go Back Dude--------------------------------------------------------------------------------
function goBackDude()
{
	window.history.back();
}
function GoBack()
{
	setTimeout('goBackDude()', 3000);
}

//--------------------------------------------------------------------------------------------

//Check empty---------------------------------------------------------------------------------
function ckEmp(frm, fld, art)
{
	var fld2ck = document.getElementById(fld);
	
	if( fld2ck.value=="" )
	{
		alert(art);
		fld2ck.focus();
	}
	else
	{
		document.forms[frm].submit();
	}
}
//--------------------------------------------------------------------------------------------



//FX------------------------------------------------------------------------------------------
function BlnkText(divID, divTxt)
{
	var BlkDiv = document.getElementById(divID);
	BlkDiv.innerHTML == '' ? BlkDiv.innerHTML = divTxt : BlkDiv.innerHTML = '';
} 

function OvrClrText(divID, divClr1, divClr2)
{
	var BlkDiv = document.getElementById(divID);
	BlkDiv.style.color == divClr1 ? BlkDiv.style.color = divClr2 : BlkDiv.style.color = divClr1;
} 

//--------------------------------------------------------------------------------------------


//Adjust Print Div----------------------------------------------------------------------------
function doPrt()
{
	window.print();
}

function doHlite(wm, tHs, lnkH, lnkU)
{
	toHl = document.getElementById(tHs);
	hLnk = document.getElementById(lnkH);
	uLnk = document.getElementById(lnkU);
	
	hlCr_1 = '#FFFFB8';
	hlCr_2 = '';
	
	switch( wm )
	{
		case 'h':
		toHl.style.backgroundColor=hlCr_1;
		hLnk.style.display='none';
		uLnk.style.display='';
		break;
		
		case 'u':
		toHl.style.backgroundColor=hlCr_2;
		hLnk.style.display='';
		uLnk.style.display='none';
		break;
		
	}
}

//--------------------------------------------------------------------------------------------


//Menu----------------------------------------------------------------------------------------
function MnuNorOvr(objId, objCls)
{
	var objToOvr = document.getElementById(objId);
	return objToOvr.className=objCls;
}

function SwapClas(objId, objCls1, objCls2)
{
	var objToSwp = document.getElementById(objId);
	return objToSwp.className==objCls1 ? objToSwp.className=objCls2 : objToSwp.className=objCls1;
}

function GoToURL(basUrl, trg)
{
	var basSitUrl = basUrl==null || basUrl=='' ? null : basUrl;
	if( trg==1 )
	{
		if( basSitUrl != null ) return window.open(basSitUrl);
		else return false;
	}
	else
	{
		if( basSitUrl != null ) return window.location = basSitUrl;
		else return false;
	}
}
//---------------------------------------------------------------------------------------------

//Show-Hide-----------------------------------------------------------------------------------
function ShwHid(Obj)
{
	var objToPrf = GEID(Obj);
	if( objToPrf.style.display=='none' )
	{
		objToPrf.style.display='';
	}
	else
	{
		objToPrf.style.display='none';
	}
}


//--------------------------------------------------------------------------------------------

//Text Service Menu---------------------------------------------------------------------------
function SetTxtCntStl(Wht2Do)
{
	var navApp = navigator.appName;
	
	var txtCnt = GEID('TxtCnt'),
		txtCntWgt = new Array('normal', 'bold'),
		txtCntFntSiz = parseInt(txtCnt.style.fontSize),
		txtCntMinFntSiz = 11, txtCntMaxFntSiz = 18;
		
		if(navApp == 'Netscape') txtCntBG = new Array('rgb(255, 255, 255)', 'rgb(255, 253, 217)');
		else txtCntBG = new Array('#ffffff', '#fffdd9');
		
	switch(Wht2Do)
	{
		case 'Light':
		txtCnt.style.backgroundColor == '' || txtCnt.style.backgroundColor == txtCntBG[0] ? 
		GEID('TxtCnt').style.backgroundColor = txtCntBG[1] : GEID('TxtCnt').style.backgroundColor = txtCntBG[0];
		break;
		
		case 'Bold':
			txtCnt.style.fontWeight == txtCntWgt[0] ? GEID('TxtCnt').style.fontWeight = txtCntWgt[1] : GEID('TxtCnt').style.fontWeight = txtCntWgt[0];
		break;
		
		case 'Larger':
			if( txtCntFntSiz >= txtCntMinFntSiz && txtCntFntSiz < txtCntMaxFntSiz )
			{ 
				GEID('CntLrgFnt').style.display = ''; GEID('CntSmlFnt').style.display = 'none';
				GEID('TxtCnt').style.fontSize = (parseInt(GEID('TxtCnt').style.fontSize)+1)+'px'; 
				GEID('CntLrgFnt').innerHTML = '('+((txtCntFntSiz+2)-txtCntMinFntSiz)+')';
			}	
		break;
		
		case 'Smaller':
			if( txtCntFntSiz > txtCntMinFntSiz && txtCntFntSiz <= txtCntMaxFntSiz )
			{ 
				GEID('CntLrgFnt').style.display = 'none'; GEID('CntSmlFnt').style.display = '';
				GEID('TxtCnt').style.fontSize = (parseInt(GEID('TxtCnt').style.fontSize)-1)+'px'; 
				GEID('CntSmlFnt').innerHTML = '('+(txtCntFntSiz-txtCntMinFntSiz)+')';
			}	
		break;
	}
}
//--------------------------------------------------------------------------------------------

//Misc-----------------------------------------------------------------------------------------
function GEID(elm)
{
	if( document.getElementById(elm) ) return document.getElementById(elm);	
	else return false;
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

//Navbar string
function SetNavPthStr(lng, homLnk)
{
	var navPthStr = document.title.split(':'),
		homNam = lng=='Ar' ? 'الرئيسية' : 'Home';
		
	GEID('NavPthStg').innerHTML = '<a href="'+homLnk+'">'+homNam+'</a> : '+navPthStr[1];
}

//Main Page Tabs
function SetTabBtn(btn, xPth, Lng)
{
	var btnTabSrc = xPth+'Lyot/'+Lng+'/MnuTab/MnuTab_0';
	var btnArr = new Array('Btn_RsvFrm', 'Btn_ConFrm', 'Btn_QFrm');
		if( btn == btnArr[0] )
		{
			MM_swapImage(btnArr[0],'',btnTabSrc+'1_o.gif',1);
			MM_swapImage(btnArr[1],'',btnTabSrc+'2_n.gif',1);
			MM_swapImage(btnArr[2],'',btnTabSrc+'3_n.gif',1);
		}
		else if(btn == btnArr[1])
		{
			MM_swapImage(btnArr[0],'',btnTabSrc+'1_n.gif',1);
			MM_swapImage(btnArr[1],'',btnTabSrc+'2_o.gif',1);
			MM_swapImage(btnArr[2],'',btnTabSrc+'3_n.gif',1);
		}
		else
		{
			MM_swapImage(btnArr[0],'',btnTabSrc+'1_n.gif',1);
			MM_swapImage(btnArr[1],'',btnTabSrc+'2_n.gif',1);
			MM_swapImage(btnArr[2],'',btnTabSrc+'3_o.gif',1);		}
}

//---------------------------------------------------------------------------------------------

