var mydt = new Date() 
function load(name,div) {
//var d = new Date();
//var t = d.getTime();
	ahah(name,div);
	return false;
}

function getData(divid,zname,pid,iST){
    cacheid=document.getElementById('cacheid').value
    if (cacheid==""){
    cacheid=mydt.getTime()
    }
    
    if (iST==0 && document.getElementById('oldsub').value!=""){ 
    
    document.getElementById(document.getElementById('oldsub').value).src="/CustomCMS/images/" + document.getElementById('oldsub').value + "_off.jpg"
    document.getElementById('oldsub').value=""   
    }
    if (document.getElementById("PID").value==pid){
    load1('/CustomCMS/loadinnerdiv_LS.aspx?zname=' + zname + '&MID=' + divid + '&cacheid=' + cacheid,'divcont');    
    }
    else
    {
    window.location='/CustomCMS/' + zname + '.aspx?MID=' + divid
    }
    //document.write('loadinnerdiv_LS.aspx?zname=' + zname + '&MID=' + divid + '&QRY=' + t)
}

function selectSUB(str){
    var o = document.getElementById('submenucont').getElementsByTagName('img');    
    for(var i=0;i<o.length;i++)
    {    
        if (o[i].id!=""){
            if (parseInt(o[i].id)==parseInt(str))
            {        
            document.getElementById(o[i].id).src="/CustomCMS/images/" + o[i].id + "_on.jpg"
            document.getElementById('oldsub').value=o[i].id            
            }
            else
            {        
            document.getElementById(o[i].id).src="/CustomCMS/images/" + o[i].id + "_off.jpg"            
            }
        }
    }
}

function loadmainmenu(MID,SMID){
cacheid=document.getElementById('cacheid').value
if (cacheid==""){
    cacheid=mydt.getTime()
    }
oldsub=document.getElementById('oldsub').value
if (oldsub==""){
load('/ArchivePDF/load_mainmenu_LS.asp?PID=' + MID + '&CURRID=' + SMID + '&myurl=' + window.location.href + '&cacheid=' + cacheid,'mainmenucol')
//document.write('/ArchivePDF/load_mainmenu_LS.asp?PID=' + MID + '&CURRID=' + SMID + '&myurl=' + window.location.href + '&cacheid=' + cacheid)
}
else
{
load('/ArchivePDF/load_mainmenu_LS.asp?PID=' + MID + '&CURRID=' + oldsub + '&myurl=' + window.location.href + '&cacheid=' + cacheid,'mainmenucol')
//document.write('/ArchivePDF/load_mainmenu_LS.asp?PID=' + MID + '&CURRID=' + oldsub + '&myurl=' + window.location.href + '&cacheid=' + cacheid)
}

}


function loadmainmenu_NM(MID,SMID){
cacheid=document.getElementById('cacheid').value
if (cacheid==""){
    cacheid=mydt.getTime()
    }
oldsub=document.getElementById('oldsub').value
//alert(cacheid + ' || ' + oldsub)
if (oldsub==""){
load('/ArchivePDF/load_mainmenu_NM.asp?PID=' + MID + '&CURRID=' + SMID + '&myurl=' + window.location.href + '&cacheid=' + cacheid,'mainmenucol')
//document.write('/ArchivePDF/load_submenu_LS.asp?MID=' + MID + '&CURRID=' + newMID + '&myurl=' + window.location.href)
}
else
{
load('/ArchivePDF/load_mainmenu_NM.asp?PID=' + MID + '&CURRID=' + oldsub + '&myurl=' + window.location.href + '&cacheid=' + cacheid,'mainmenucol')
//document.write('/ArchivePDF/load_submenu_LS.asp?MID=' + MID + '&CURRID=' + oldsub + '&myurl=' + window.location.href)
}

}



function loadsubcontent(MID,newMID){
cacheid=document.getElementById('cacheid').value
oldsub=document.getElementById('oldsub').value
if (cacheid==""){
    cacheid=mydt.getTime()
    }
if (oldsub==""){
load('/ArchivePDF/load_submenu_LS.asp?MID=' + MID + '&CURRID=' + newMID + '&myurl=' + window.location.href + '&cacheid=' + cacheid,'submenucont')
//document.write('/ArchivePDF/load_submenu_LS.asp?MID=' + MID + '&CURRID=' + newMID + '&myurl=' + window.location.href)
}
else
{
load('/ArchivePDF/load_submenu_LS.asp?MID=' + MID + '&CURRID=' + oldsub + '&myurl=' + window.location.href + '&cacheid=' + cacheid,'submenucont')
//document.write('/ArchivePDF/load_submenu_LS.asp?MID=' + MID + '&CURRID=' + oldsub + '&myurl=' + window.location.href)
}
}

function load1(name,div) {
	ahah1(name,div);
	return false;
}

function loaddate(){
cacheid=document.getElementById('cacheid').value
if (cacheid==""){
    cacheid=mydt.getTime()
    }
var strsec;
//strsec='/CustomCMS/header_date.asp?cacheid=' + cacheid
strsec='/CustomCMS/headerdate.txt?cacheid=' + cacheid
load(strsec,'divdatecont');
}
 
 function searchcont()
 {
  var a = encodeURI(document.getElementById('txtsearch').value);
//document.forms[0].search.value ;
  //var mystr="بحث في الأعداد السابقة"  
  //if (a==mystr){  
  //a=""
 // }  
  b ="/absolutenmnew/PPLSearch.aspx?search="+ a
  window.open (b);
}
function cngtext(id,iFlag){
document.getElementById(id).value=""
}

var min=10;
var max=15;
function increaseFontSize() {

   var p = document.getElementById("HN").getElementsByTagName("span");
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("pt",""));
      } else {
         var s = 12;
      }
      if(s!=max) {
         s += 1;
      }
      p[i].style.fontSize = s+"pt"
   }   

//document.getElementById("HN").getElementsByTagName("span").item(0).style.fontSize="40pt"

}
function decreaseFontSize() {
   var p = document.getElementById("HN").getElementsByTagName("span");
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("pt",""));
      } else {
         var s = 12;
      }
      if(s!=min) {
         s -= 1;
      }
      p[i].style.fontSize = s+"pt"
   }   
}

function defaultsize() {
   var p = document.getElementById("HN").getElementsByTagName("span");
   for(i=0;i<p.length;i++) {
      p[i].style.fontSize ="10pt"
   }   
}

function resizefrm(id){
//alert(id);
var iframeids=[id]
//Should script hide iframe from browsers that don't support this script (non IE5+/NS6+ browsers. Recommended):
var iframehide="yes"

var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
var FFextraHeight=parseFloat(getFFVersion)>=0.1? 16 : 0 //extra height in px to add to iframe in FireFox 1.0+ browsers

function resizeCaller() {
var dyniframe=new Array()
for (i=0; i<iframeids.length; i++){
if (document.getElementById)
resizeIframe(iframeids[i])
//reveal iframe for lower end browsers? (see var above):
if ((document.all || document.getElementById) && iframehide=="no"){
var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
tempobj.style.display="block"
}
}
}

function resizeIframe(frameid){
var currentfr=document.getElementById(frameid)
if (currentfr && !window.opera){
currentfr.style.display="block"
if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) //ns6 syntax
currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextraHeight; 

else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax
currentfr.height = currentfr.Document.body.scrollHeight;

if (currentfr.addEventListener)
currentfr.addEventListener("load", readjustIframe, false)
else if (currentfr.attachEvent){
currentfr.detachEvent("onload", readjustIframe) // Bug fix line
currentfr.attachEvent("onload", readjustIframe)
}
}
}

function readjustIframe(loadevt) {
var crossevt=(window.event)? event : loadevt
var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
if (iframeroot)
resizeIframe(iframeroot.id);
}

function loadintoIframe(iframeid, url){
if (document.getElementById)
document.getElementById(iframeid).src=url
}

if (window.addEventListener)
window.addEventListener("load", resizeCaller, false)
else if (window.attachEvent)
window.attachEvent("onload", resizeCaller)
else
window.onload=resizeCaller
}