﻿
function genn(){
}
function Toggle(item) {
   objReq=document.getElementById(item);
   visible=(objReq.style.display!="none")
   if (visible) {
     objReq.style.display="none";
   } else {
      objReq.style.display="block";
   }
}

var TRange=null
function findString (str) {
////////////////
 while (str.substring(0,1) == ' ') 
    { 
        if(str.length > 1)
            str = str.substring(1, str.length); 
        else
            str='';
    } 
while (str.substring(str.length-1, str.length) == ' ') 
    { 
        if(str.length > 1)
            str = str.substring(0,str.length-1); 
        else
            str='';
    } 
    
    if(str == '')
    {
        if(getCookie("IftaaPreferredTheme").indexOf("_en")!= -1) //language is English
            alert("You must Enter the Search Word")
        else if(getCookie("IftaaPreferredTheme").indexOf("_fr")!= -1) //language is French
            alert("Il faut insérer le mot de la recherche")
        else
            alert("يجب إدخال كلمة البحث") // default case ==> language is Arabic
        return;
    }
////////////////////
 if (parseInt(navigator.appVersion)<4) return;
 var strFound;
 

 if (navigator.appName=="Netscape") {
  // NAVIGATOR-SPECIFIC CODE
  /*
  strFound=self.find(str); 
  if (!strFound) {
   strFound=self.find(str,0,1)
   while (self.find(str,0,1)) continue
  }*/
      if (window.find) { //mae to let this function work in ntestscape and firefox

      // CODE FOR BROWSERS THAT SUPPORT window.find

      strFound=self.find(str);
      if (strFound && self.getSelection && !self.getSelection().anchorNode) {
       strFound=self.find(str);

      }
      if (!strFound) {
       strFound=self.find(str,0,1)
       while (self.find(str,0,1)) continue
      }
     }


 }
 if (navigator.appName.indexOf("Microsoft")!=-1) {
   
  // EXPLORER-SPECIFIC CODE
  if (TRange!=null) {
   TRange.collapse(false)
   strFound=TRange.findText(str)
   
   if (strFound) TRange.select()
  }
  if (TRange==null || strFound==0) {
   TRange=self.document.body.createTextRange() 
   strFound=TRange.findText(str)
   if (strFound) TRange.select()
  }
 }
 
 if (!strFound)
 {
    if(getCookie("IftaaPreferredTheme").indexOf("_en")!= -1) //language is English
        alert("Text not found !")
    else if(getCookie("IftaaPreferredTheme").indexOf("_fr")!= -1) //language is French
        alert("Le texte ne figure pas sur cette page !")
    else
        alert("النص غير موجود بالصفحة") // default case ==> language is Arabic
 }
}
function TogglePageCookie(pagesCookies) {
          var PageCookieStatus=pagesCookies;
		  names=document.getElementsByName("PAGEID");
		  partIDArr=document.getElementsByName("PARTID");
		  openArrowArr=document.getElementsByName("openArrow");
		  closeArrowArr=document.getElementsByName("closeArrow");
		  smallquotArr=document.getElementsByName("smallquot");
		  for (i=0;i<names.length;i++) {
		    names[i].style.display = PageCookieStatus;
          }
     
     if(names.length>0)
	if( names[0].style.display =="none" )	
	{//pages are not displyaed
	//alert("Parts are none");
	 if( (partIDArr.length>0) && (partIDArr[0].style.display=="") ){
	             //alert("Parts EXIST");
					 for (ii=0;ii<closeArrowArr.length;ii++) {
					    if( smallquotArr.length>0) 
					      smallquotArr[ii].style.display="none";
					    if( closeArrowArr.length>0) 
						  closeArrowArr[ii].style.display="";
						if( openArrowArr.length>0)     
						  openArrowArr[ii].style.display="";
						}
					}else{
					//alert("NO Parts");
						for (iii=0;iii<closeArrowArr.length;iii++) {
						if( smallquotArr.length>0) 
						  smallquotArr[iii].style.display="none";
						if( closeArrowArr.length>0) 
						  closeArrowArr[iii].style.display="none";
						if( openArrowArr.length>0) 
						  openArrowArr[iii].style.display="none";
						}//for
					}//else
	
	}
	else{ //Pages are diplayed
	//alert("Pages displayed");
	for (iii=0; iii<closeArrowArr.length || iii<openArrowArr.length ;iii++) {
	    if( ( smallquotArr.length>0)&& (partIDArr.length>0) && partIDArr[0].style.display=="none"){
	      
	        smallquotArr[iii].style.display="none";
	        }
	    else{
	        if( smallquotArr.length>0) 
	        smallquotArr[iii].style.display="";
	        }
	        if( closeArrowArr.length>0) 
			  closeArrowArr[iii].style.display="";
			if( openArrowArr.length>0) 
			  openArrowArr[iii].style.display="";
		}//for
	}
SetCookie("PagesCookie", PageCookieStatus);
}
function SetCookie(name, value, path)
{
    document.cookie = name + "=" + value + ";path=" + path;
}
function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=")
  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1 
    c_end=document.cookie.indexOf(";",c_start)
    if (c_end==-1) c_end=document.cookie.length
    return unescape(document.cookie.substring(c_start,c_end))
    } 
  }
return ""
}
function SetVar(Str)
{
	x = SetCookie('ID',Str,2);
}
