﻿var lang = 1;
function ChangeLang(tar,dir){
	ta = this[tar].criteria.style.textAlign;
	dr = this[tar].criteria.style.direction;
	switch (lang) {
	case 0:
		LangFar(this[tar].criteria);
		if (!dir){
			this[tar].criteria.style.textAlign = ta;
			this[tar].criteria.style.direction = dr;
			this[tar].criteria.focus();
		}
		this[tar].LangImg.src='Images/en.gif';
		this[tar].LangImg.alt='English';
		lang = 1;
		break;
	case 1:
		LangEng(this[tar].criteria);
		if (!dir){
			this[tar].criteria.style.textAlign = ta;
			this[tar].criteria.style.direction = dr;
			this[tar].criteria.focus();
		}
		this[tar].LangImg.src='Images/fa.gif';
		this[tar].LangImg.alt='فارسي';
		lang = 0;
		break;
	default:
		window.status = "Error!";
	}
}

function blockError(){
	return true;
}
var appURL = String(document.location);
if (appURL.indexOf("debuging=true") != -1) {
	// ---
} else {
	window.onerror= blockError;
}
// -------- downer!
var top = -313;
var bot = 87;

var right = 778;
var left = 200;

var speed = 3;
//Don't edit anything after here
var delay = 20;
var m;
var ie = (document.all) ? 1:0;

function downer(lay) {
	test = document.all[lay].style.pixelTop>=bot;
	if (!test) {
		document.all[lay].style.pixelTop += speed;
		m = setTimeout("downer('"+lay+"')", delay);
	} else{
		m = setTimeout("upper('"+lay+"')", 3000);
		layb.style.visibility = 'visible';
	}
}
function upper(lay) {
	test = document.all[lay].style.pixelTop<=top;
	if (!test) {
		document.all[lay].style.pixelTop -= speed;
		m = setTimeout("upper('"+lay+"')", delay);
	}else{
		laya.style.visibility = 'hidden';
		m = setTimeout("lefter('layb')", delay);
	}
}
function lefter(lay) {
	test = document.all[lay].style.pixelRight>=right;
	if (!test) {
		document.all[lay].style.pixelRight += speed;
		m = setTimeout("lefter('"+lay+"')", delay);
	}
}
function righter(lay) {
	test = document.all[lay].style.pixelRight<=left;
	if (!test) {
		document.all[lay].style.pixelRight -= speed;
		m = setTimeout("righter('"+lay+"')", delay);
	}
}

function getLeft(r){
	return (window.screen.width - r);
}



// --------
document.write("<div id='waitDiv' style='position:absolute;left:40%;top:45%;visibility:hidden;text-align: center;'>\r\n\t<table cellpadding='13' style=\"WIDTH: 215px\" cellSpacing=\"0\" cellPadding=\"0\" width=\"150\" border=\"0\">\r\n\t\t<tr>\r\n\t\t\t<td align='center' style=\"BORDER-RIGHT: #6699cc 1px solid; BORDER-LEFT: #6699cc 1px solid; BORDER-BOTTOM: #6699cc 1px solid; BORDER-TOP: #6699cc 1px solid; BACKGROUND-COLOR: #ffffff\">\r\n\t\t\t\t<font class=text2 style=\"DISPLAY: inline-block; PADDING-RIGHT: 11px; BACKGROUND-COLOR: transparent; COLOR=#000000\">\r\n\t\t\t\t\t\t\t\t\tلطفا صبر کنيد ...</font>\r\n\t\t\t\t<br>\r\n\t\t\t\t<img src='Images/await.gif'>\r\n\t\t\t\t<br>\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t</table>\r\n</div>");
function showWaitMessage(div,flag) {
	this[div].style.visibility = (flag) ? 'visible':'hidden';
} 
//showWaitMessage('waitDiv', 1);
function hideElement(){
	if (document.getElementById("amazon")){
		amazon.style.visibility = "hidden";
	}
}
function showElement(){
	if (document.getElementById("amazon")){
		amazon.style.visibility = "";
	}
}
// ------------
function navBar( tableCellRef, hoverFlag, navStyle ) {
	if ( hoverFlag ) {
	
	tableCellRef.style.backgroundColor = '#69c';
	
	} else {
		
		tableCellRef.style.backgroundColor = '#036';
	}
}
// ------------
function unavBar( tableCellRef, hoverFlag, navStyle ) {
	if ( hoverFlag ) {
	
	tableCellRef.getElementsByTagName( 'a' )[0].style.color = '#c00';
	
	
	} else {
		
		tableCellRef.getElementsByTagName( 'a' )[0].style.color = '#000';
		
	}
}
function goTo( url ) {
	
	window.parent.location.href = url;
}
// ------------------
  var eOpenMenu = null;
  var sOpenMenu = null;
  var flgDayFocus = false;
  function OpenMenu(eMenu){
//    eMenu.style.left = window.event.srcElement.parentElement.offsetLeft + divMenuBar.offsetLeft;
//    eMenu.style.top = divMenuBar.offsetHeight + divMenuBar.offsetTop + eMenu.offsetHeight;
//    window.status = divMenuBar3.offsetHeight + " - - - " + divMenuBar3.offsetTop;
    eMenu.style.visibility = "visible";
    eOpenMenu = eMenu;
	hideElement();
  }
  function CloseMenu(eMenu){
    eMenu.style.visibility = "hidden";
    eOpenMenu = null;
    showElement();
  }
  function MenuBar_over(LayMenu){
      var eMenu = LayMenu;
      if (eOpenMenu && eOpenMenu != eMenu){
        CloseMenu(eOpenMenu);}
      if (eMenu){
		  OpenMenu(eMenu);}
//	Layerc.style.top = window.event.srcElement.parentElement.offsetHeight;
//	Layerc.style.right = window.event.srcElement.parentElement.offsetLeft + divMenuBar.width;
  }
  function MenuBar_out(){
   var eTo = window.event.toElement;
    if (eOpenMenu && eTo && !eOpenMenu.contains(eTo)){
      CloseMenu(eOpenMenu);
	  if (sOpenMenu){CloseMenu_level2(sOpenMenu)};
	  }
	}
  function Menu_out(){
    var eSrc = window.event.toElement;
    if (eOpenMenu && !eOpenMenu.contains(eSrc) && !divMenuBar.contains(eSrc) && !sOpenMenu.contains(eSrc)){
      CloseMenu(eOpenMenu);
	  if (sOpenMenu){CloseMenu_level2(sOpenMenu)};
	  }
	}
//-------
  function OpenMenu_level2(eMenu){
    eMenu.style.visibility = "visible";
    sOpenMenu = eMenu;
  }
    function CloseMenu_level2(eMenu){
    eMenu.style.visibility = "hidden";
    sOpenMenu = null;
  }

  function Open_over(LayMenu){
      var eMenu = LayMenu;
      if (sOpenMenu && sOpenMenu != LayMenu){
        CloseMenu_level2(sOpenMenu);}
      if (eMenu){
		  OpenMenu_level2(LayMenu);
		  sOpenMenu = LayMenu;
		  }
	  
  }
    function Menu_out_level2(){
    if (!flgDayFocus){
	Menu_out();
   var eTo = window.event.toElement;
    if (sOpenMenu && eTo && !sOpenMenu.contains(eTo)){
      CloseMenu_level2(sOpenMenu)}}
	}
//document.write("<script language=\"JavaScript\" src=\"Scripts/cswindowscroll.js\" type=\"text/javascript\"></script>");