/*-----------------------------------------[ for site]-----------------------------------------------*/
var sNavFlag  = ""; //FireFox -> 'ff'; Internet Explorer -> 'ie'; Opera -> 'op'; 
var sFixId 	  = new String();
var pRollImgs = new Array();
var pGELContent = null;

function getNavigatorFlag(){ 	
 if(navigator.appName.toUpperCase().indexOf("EXPLORE") != -1)
    sNavFlag = "ie";
 	else if(navigator.appName.toUpperCase().indexOf("NETSCAPE") != -1)
 	        sNavFlag = "ff"; 
 	       else if(navigator.appName.toUpperCase().indexOf("OPERA") != -1) 
 	               sNavFlag = "op";  
}

function preload_this(iFixInx){
   var iArg = preload_this.arguments; 	 	      
     for(var i=0; i < iArg.length-1; i++){ 	 	  	 	 
 	 	 pRollImgs[i] = new Image;
 	 	 pRollImgs[i].src = preload_this.arguments[i+1]; 	 	 	  	 	  	 	  	 	  	 	 
 	 	 if (i == iFixInx)
          pRollImgs[i].id = sFixId;
 	 	 else
 	 	  pRollImgs[i].id  = iArg[i+1].slice(iArg[i+1].lastIndexOf("/")+1, iArg[i+1].lastIndexOf("."));
 	    }  
} 

function inLoadPage(sFix){    
//-------------------------------------------------------------------------------------------------- 	 	   
 getNavigatorFlag();                          	  
 switch(sFix){
  case "theTitlePage"   : preload_this(0,'img/zpl_2x2.gif','img/theAddToFavorite.gif',
                                         'img/theSendEmail.gif','img/theContactInfo.gif','img/theNull.gif');                                      
                                       break;  
  case "theContactInfo" : preload_this(3,'img/theTitlePage.gif','img/theAddToFavorite.gif',
                                         'img/theSendEmail.gif','img/zpl_2x2.gif','img/theNull.gif');                                       
                                       break;                                       
  default : preload_this(4,'img/theTitlePage.gif','img/theAddToFavorite.gif',
                           'img/theSendEmail.gif','img/theContactInfo.gif','img/zpl_2x2.gif');
                                      	
  } 
 var IsSel = null;
     IsSel = document.getElementById("idIsSel");
 if(IsSel != null) 
  {
	 var IsNav = document.getElementById("idNavigLayer");
	 var idIsBot = document.getElementById("idIsBot");
	 
      if( ((IsNav.clientHeight - IsSel.offsetTop) <= 50) || ((IsNav.clientHeight - IsSel.offsetTop) < 0) )  idIsBot.focus(); 
  }
 
}

//cross browser function witch add this url to favorite
function onAddToFavorite(){
var sTitle = document.title;
var sURL   = top.location.href; 
 if(sNavFlag == "ff"){ 	
 	window.sidebar.addPanel(sTitle, sURL, ''); 	
 	}else if(sNavFlag == "op"){ 		
 		var tmp = document.createElement("A");
 			tmp.setAttribute('rel', 'sidebar',0);
			tmp.setAttribute('href', sURL,0);
 			tmp.setAttribute('title', sTitle,0);
 			tmp.click();
 		}else if(sNavFlag == "ie") 
 		        window.external.AddFavorite(sURL, sTitle);
 		      else return;  
};
//--------------------------------------------[ my rollOver effect]------------------------------------------------------ 
function findThisObj(sId){
  for (var i=0; i < pRollImgs.length; i++)
  	 if (pRollImgs[i].id == sId) return pRollImgs[i];
 };

function onMyNavig_Hover(sIdObj){  			
if(pRollImgs == null) return;

 if (sIdObj != sFixId){ 	
	var pObj = document.getElementById(sIdObj);
	var sFileName = pObj.getAttribute("src"); 
	var pImg = findThisObj(sIdObj);
	    pObj.setAttribute("src", pImg.src, 0);  
	    pImg.src = sFileName; 			    
   }     	      
}

function onMyNavig_Click(sIdObj){ 
if(pRollImgs == null) return;
//replace image
var sOldFixId = sFixId; sFixId = sIdObj;  
//do action for this link  
  onMyNavig_Hover(sOldFixId); 	     
};
//-----------------------------------------[ change_url_on_click ]------------------------------------------ 
function change_url_on_click(crURL, lim, host){
 mdURL = crURL.split("_");
 
 if ((parseInt(mdURL[2]) + 1) <= lim) 
  document.location = (host + mdURL[0] + "_" + mdURL[1] + "_" + (parseInt(mdURL[2]) + 1) + ".html");  
 if ((parseInt(mdURL[2]) + 1) > lim)  
  document.location = (host + mdURL[0] + "_" + mdURL[1] + "_" + 1 + ".html"); 
}
/*-----------------------------------------[ for admin part]-----------------------------------------------*/

function mark_field(cntrl, flag)
{
var defColor = '#FFFFCC';
var selColor = '#FEC603';
var captCell = cntrl.parentNode.previousSibling.previousSibling;
 
 if (flag){
  cntrl.parentNode.style.backgroundColor = selColor; 
  captCell.style.backgroundColor = selColor;
  captCell.childNodes[2].style.color = "#FF0000";
  captCell.childNodes[2].style.fontWeight = "bold";
 }else{
       cntrl.parentNode.style.backgroundColor = defColor;
       captCell.style.backgroundColor = defColor;
       captCell.childNodes[2].style.color = "#000099";
       captCell.childNodes[2].style.fontWeight = "normal";
      }
}

function IndInpLen(cntrl)
{
var pIndNum = cntrl.parentNode.previousSibling.previousSibling.childNodes[2];
var fixPos  = pIndNum.innerHTML.indexOf(" ");
var truncTxt = pIndNum.innerHTML.substring(fixPos, pIndNum.innerHTML.length);
var iChrCnt  = cntrl.maxLength - cntrl.value.length;

 pIndNum.innerHTML = "(" + iChrCnt + truncTxt;
}

function do_sel_post(thisForm, selElm, valElm, inxElm)
{
  thisForm[valElm].value = selElm.options[selElm.options.selectedIndex].text;
  thisForm[inxElm].value = selElm.options.selectedIndex;  
  thisForm.method="post";
  thisForm.action="index.php";
  thisForm.submit();
}

function clear_inForm(thisForm, clrElm){	 
 thisForm[clrElm].value = 1;
 thisForm.method="post";
 thisForm.action="index.php";
 thisForm.submit();	
} 

function delete_inForm(thisForm, delElm){ 
 thisForm[delElm].value = 1;
 thisForm.method="post";
 thisForm.action="index.php";
 thisForm.submit();	
}



