<!--

/*
var iSecondToRefresh = 5;
function RefreshPage(){
var strUrl = location.href;
SendQuery(strUrl);
}
window.setInterval("RefreshPage()",iSecondToRefresh*1000);
*/

function checkAll(field,chkName) 
		{
 		  var controlIndex;
  		 var element;
  		 var numberOfControls = document.forms.item(0).length;
 		  for (controlIndex = 0; controlIndex < numberOfControls; controlIndex++)
 		  {
  		    element = document.forms.item(0)[controlIndex];
   		   if (element.type == "checkbox" && element.name.indexOf(chkName)>=0)
   		   {
    		     if (field.checked == true){
     		        element.checked = true;
     		    }else{
     		        element.checked = false;
     		    }
     		 }
   		}
		}

	
function IsAllChecked(chkName) 
		{
		 var CountChecked=0;
 		 var controlIndex;
  		 var element;
  		 var numberOfControls = document.forms.item(0).length;
 		  for (controlIndex = 0; controlIndex < numberOfControls; controlIndex++)
 		  {
  		    element = document.forms.item(0)[controlIndex];
   		   if (element.type == "checkbox" && element.name.indexOf(chkName)>=0)
   		   {
     		     if (element.checked == true){
     		        CountChecked++;
     		        }
     		 }
   		}
   		
   			if(CountChecked==0){
   				alert('هيچ گزينه اي براي حذف انتخاب نشده است.');
   				return false;
   			}else{
   			  if(CountChecked==1){
   				if(confirm('آيا مطمئن هستيد كه ميخواهيد آيتم هاي انتخاب شده را حذف كنبد؟')==1){
   					return true;
   				}else{
   					return false;
   				}
   			  }else{
   			    if(confirm('آيا مطمئن هستيد كه ميخواهيد آيتم انتخاب شده را حذف كنبد؟')==1){
   					return true;
   				}else{
   					return false;
   				}
   			  }
   			}
		}

function ShowPopUpMessage(divId,title){

	var div = document.getElementById(divId);
	var divTable = document.getElementById("div_Table_Panel_Skin");
	var divPopUpMessage = document.getElementById("divPopUpMessage");
	divPopUpMessage.style.left=event.clientX + document.body.scrollLeft-150;
	divPopUpMessage.style.top=event.clientY + document.body.scrollTop + 10;
	divPopUpMessage.style.display="block";
	divPopUpMessage.innerHTML = "";
	divPopUpMessage.innerHTML = divTable.innerHTML.replace("[MAIN]",div.innerHTML);
	divPopUpMessage.innerHTML = divPopUpMessage.innerHTML.replace("[TITLE]",title);
}

function HidePopUpMessage(){var divPopUpMessage = document.getElementById("divPopUpMessage");divPopUpMessage.style.display="none";}function Initialize(){try{req=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{req=new ActiveXObject("Microsoft.XMLHTTP");}catch(oc){req=null;}}if(!req&&typeof XMLHttpRequest!="undefined"){req=new XMLHttpRequest();}}

function ShowPopUp(div){
	var divPopUp = document.getElementById(div);

	divPopUp.style.left=event.clientX + document.body.scrollLeft;
	divPopUp.style.top=event.clientY + document.body.scrollTop + 10;
	divPopUp.style.display="block";
}


function HidePopUp(div){
	var divPopUp = document.getElementById(div);
	divPopUp.style.display="none";
}


function ShowPrintPreview()
{
   var eTDMain = document.getElementById("Theme_tdMain");
   var oWindow = window.open('Print','PrintPreview','width=700,height=500,scrollbars=yes,toolbar=yes,menubar=yes');
   var strTDMain = eTDMain.innerHTML;
   strTDMain+="<html><head><title>PrintPreview</title>";
   strTDMain+="<LINK href='Themes/MainSkins/Default/Styles/Panel.css' type='text/css' rel='stylesheet'></LINK><LINK href='Themes/MainSkins/Default/Styles/Skin.css' type='text/css' rel='stylesheet'></LINK>"
   strTDMain+="</head>";
   strTDMain+="<body>";
   oWindow.document.write(strTDMain);
   strTDMain+="</body>";
}

function GetContentSite()
{
   var eTDMain = document.getElementById("Theme_tdMain");
   var eht1 = document.frmDefault.htContentSite;

   eht1.value = eTDMain.innerHTML ;
}

function ShowNewWindow(path,width,height){

   var eTDMain = document.getElementById("Theme_tdMain");
   var oWindow = window.open(path,'NewWindow','width='+width+',height='+height+',scrollbars=yes,toolbar=no,menubar=no,status=yes');
   oWindow.moveTo(2,2);
   var oDiv = document.getElementById(divId)
   oWindow.document.write(oDiv.innerHTML);

}

function noCache(){
    var myImage1 = new Image();	
        myImage1.src = 'Panel/Images/SmallSecurityCode2.jpg';
    var myImage2 = new Image();	
        myImage2.src = 'Panel/Images/SecurityCode2.jpg';
    var clocktime = new Date();
    var utchours = clocktime.getUTCHours();
    var utcminutes = clocktime.getUTCMinutes();
    var utcseconds = clocktime.getUTCSeconds();
    var utcyear = clocktime.getUTCFullYear();
    var utcmonth = clocktime.getUTCMonth()+1;
    var utcday = clocktime.getUTCDate();
    var utctime = utcyear+''+utcmonth+''+utcday;
        utctime += utchours+''+utcminutes+''+utcseconds;
 
  if(document.images['imgSecurityCode1']!=null){
      isNew = myImage1.src;
        if(!isNew.match('#')){
           document.images['imgSecurityCode1'].src = myImage1.src+'?'+utctime;
        }
      else{document.images['imgSecurityCode1'].src = document.images['imgSecurityCode1'].src;
    }
   }

  if(document.images['imgSecurityCode2']!=null){
      isNew = myImage2.src;
        if(!isNew.match('#')){
           document.images['imgSecurityCode2'].src = myImage2.src+'?'+utctime;
        }
      else{document.images['imgSecurityCode2'].src = document.images['imgSecurityCode2'].src;
    }
   }

}


function DeleteDefaultText(field,txt){
   if(field.value==txt){
       field.value='';
   }
}


function InsertDefaultText(field,txt){
   if(field.value==''){
       field.value=txt;
   }
}

function CheckLoadInParent(){
   if(document.getElementById("fPanel")==null){location.href='default.aspx?app=Panel&page=admins&temp=yes';}
}


var IFrameObj; // our IFrame object
function SendQuery(URL) {
  if (!document.createElement) {return true};
  document.getElementById("Theme_tdMain").innerHTML = "<div align=center><BR><BR><BR><BR><img src='Panel/Images/ProgressBar.gif'></div>";

  var IFrameDoc;
  URL = URL.replace(/default.aspx?/i,"object.aspx");
  if (!IFrameObj && document.createElement) {
    // create the IFrame and assign a reference to the
    // object to our global variable IFrameObj.
    // this will only happen the first time 
    // callToServer() is called
   try {
      var tempIFrame=document.createElement('iframe');
      tempIFrame.setAttribute('id','RSIFrame');
      tempIFrame.style.border='0px';
      tempIFrame.style.width='0px';
      tempIFrame.style.height='0px';
      IFrameObj = document.body.appendChild(tempIFrame);
      
      if (document.frames) {
        // this is for IE5 Mac, because it will only
        // allow access to the document object
        // of the IFrame if we access it through
        // the document.frames array
        IFrameObj = document.frames['RSIFrame'];
      }
    } catch(exception) {
      // This is for IE5 PC, which does not allow dynamic creation
      // and manipulation of an iframe object. Instead, we'll fake
      // it up by creating our own objects.
      iframeHTML='\<iframe id="RSIFrame" style="';
      iframeHTML+='border:0px;';
      iframeHTML+='width:0px;';
      iframeHTML+='height:0px;';
      iframeHTML+='"><\/iframe>';
      document.body.innerHTML+=iframeHTML;
      IFrameObj = new Object();
      IFrameObj.document = new Object();
      IFrameObj.document.location = new Object();
      IFrameObj.document.location.iframe = document.getElementById('RSIFrame');
      IFrameObj.document.location.replace = function(location) {
        this.iframe.src = location;  
      }
    }
  }

  if (navigator.userAgent.indexOf('Gecko') !=-1 && !IFrameObj.contentDocument) {
    // we have to give NS6 a fraction of a second
    // to recognize the new IFrame
    setTimeout('callToServer()',10);
    return false;
  }
  
  if (IFrameObj.contentDocument) {
    // For NS6
    IFrameDoc = IFrameObj.contentDocument; 
  } else if (IFrameObj.contentWindow) {
    // For IE5.5 and IE6
    IFrameDoc = IFrameObj.contentWindow.document;
  } else if (IFrameObj.document) {
    // For IE5
    IFrameDoc = IFrameObj.document;
  } else {
    return true;
  }

  IFrameDoc.location.replace(URL); 
  return false;
}

function GetData(sHTML){
Theme_tdMain.innerHTML = sHTML;
}


function RequestQueryString(variable) {
  var query = window.location.search.substring(1);
  var vars = query.split("&");
  for (var i=0;i<vars.length;i++) {
    var pair = vars[i].split("=");
    if (pair[0] == variable) {
      return pair[1];
    }
  } 
  return "";
}

function ShowProgressBar(divId){
   document.getElementById(divId).innerHTML = "<img src=Panel/Images/menuloading.gif>";
   document.getElementById(divId).style.display = "block";
}
function HideProgressBar(divId){
   document.getElementById(divId).style.display = "none";
}

// -->
