﻿var origClass = "";
function imgOver( divId ) {
	if (document.getElementById) {
		origClass = document.getElementById( divId.id ).className;
		document.getElementById( divId.id ).className = origClass + ' cel-over';
	}
}
function imgOut( divId ) {
	if (document.getElementById) {
		document.getElementById( divId.id ).className = origClass;
	}
}
//////////////////////////////////////////// print Content of Page //////////////////////////////////////
function printMe(tempPID,tempNID,tempEID)
{
	str1 = "page_print.asp?PID=".concat(tempPID,"")
	str1 = str1.concat("&NID=","")
	str1 = str1.concat(tempNID,"")
	str1 = str1.concat("&EID=","")
	str1 = str1.concat(tempEID,"")
	window.open(str1,"myNewWin","top=20,left=20,width=700,height=500,resizable=1,menubar=1,scrollbars=1,status=1"); 
} 
///////////////////////////// Open Video Clip Page //////////////////////////////////////////////
function openClip(tempUrl) 
{ 
	str1 = "video_main.asp?clp=".concat(tempUrl,"")
	window.open(str1,"myNewWin","top=90,left=90,width=362,height=362,resizable=0,menubar=0,scrollbars=0,status=0"); 
} 
///////////////////////////////////////////// Popup Page Maker/////////////////////////////////////////
/*
URL  String specifying the location of the Web page to be displayed in the new window. If you do not want to specify the location, pass an empty string as the URL (this may be the case when you are going to write some script-generated content to your new window).  
name  String specifying the name of the new window. This name can be used in the same constructions as the frame name provided in the frame tag within a frameset <FRAME NAME=name ...>. For example, you can use hyperlinks of the form <a target=name href="page.htm">, and the hyperlink destination page will be displayed in your new window. 
If a window with this name already exists, then window.open() will display the new content in that existing window, rather than creating a new one. 
 
features  An optional string parameter specifying the features of the new window. The features string may contain one or more feature=value pairs separated by commas.  
replace  An optional boolean parameter. If true, the new location will replace the current page in the browser's navigation history. Note that some browsers will simply ignore this parameter.  


The following features are available in most browsers: toolbar=0|1  Specifies whether to display the toolbar in the new window.  
location=0|1  Specifies whether to display the address line in the new window.  
directories=0|1  Specifies whether to display the Netscape directory buttons.  
status=0|1  Specifies whether to display the browser status bar.  
menubar=0|1  Specifies whether to display the browser menu bar.  
scrollbars=0|1  Specifies whether the new window should have scrollbars.  
resizable=0|1  Specifies whether the new window is resizable.  
width=pixels  Specifies the width of the new window.  
height=pixels  Specifies the height of the new window.  
top=pixels  Specifies the Y coordinate of the top left corner of the new window. (Not supported in version 3 browsers.)  
left=pixels  Specifies the X coordinate of the top left corner of the new window. (Not supported in version 3 browsers.)  
*/

function ShowPopup( strUrl, strName, blnToolbar, blnLocation, blnDirectories, blnStatus, blnMenubar, blnScrollbars, blnResizable, strWidth, strHeight, strTop, strLeft ) {
	DesignerWizWin = window.open(strUrl, strName, 'toolbar=blnToolbar, location=blnLocation, directories=blnDirectories, status=blnStatus, menuBar=blnMenubar, scrollbars=blnScrollbars, resizable=blnResizable, width=strWidth, height=strHeight, left=strLeft, top=strTop');
}
////////////////////////////////////////////////////////////////////////////////////////////////

///////////////////////// Farsi Type ///////////////////////////////////////////////////////////////
function storeCaret(textEl) {
	if (textEl.createTextRange) 
	textEl.caretPos = document.selection.createRange().duplicate();

}
var lang = 1;	// 1: Farsi, 0: English

// Farsi keyboard map based on ISIRI-2901
var farsikey = [
   0x0020, 0x0021, 0x061B, 0x066B, 0x00A4, 0x066A, 0x060C, 0x06AF,
   0x0029, 0x0028, 0x002A, 0x002B, 0x0648, 0x002D, 0x002E, 0x002F,
   0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
   0x0038, 0x0039, 0x003A, 0x0643, 0x003E, 0x003D, 0x003C, 0x061F,
   0x066C, 0x0624, 0x200C, 0x0698, 0x0649, 0x064D, 0x0625, 0x0623,
   0x0622, 0x0651, 0x0629, 0x00BB, 0x00AB, 0x0621, 0x004E, 0x005D,
   0x005B, 0x0652, 0x064B, 0x0626, 0x064F, 0x064E, 0x0056, 0x064C,
   0x0058, 0x0650, 0x0643, 0x062C, 0x005C, 0x0686, 0x00D7, 0x0640,
   0x200D, 0x0634, 0x0630, 0x0632, 0x064A, 0x062B, 0x0628, 0x0644,
   0x0627, 0x0647, 0x062A, 0x0646, 0x0645, 0x067E, 0x062F, 0x062E,
   0x062D, 0x0636, 0x0642, 0x0633, 0x0641, 0x0639, 0x0631, 0x0635,
   0x0637, 0x063A, 0x0638, 0x007D, 0x007C, 0x007B, 0x007E ];


function changeLang() {
    if (lang == 0) {
    lang = 1;
    return true;
  }
  else {
    lang = 0;
    return true;
  }
}

function FKeyDown (txtFrm){
 var key = window.event.keyCode;
 if (key == 145){
    if (lang == 0) {
      lang = 1;
      return true;
    }
    else {
      lang = 0;
      return true;
    }

}

}
function FKeyPress(txtFrm) {
   var key = window.event.keyCode;

  if (key == 13) { window.event.keyCode = 13; return true; }

   if (lang == 1) { // If Farsi
     if (key == 0x0020 && window.event.shiftKey) // Shift-space -> ZWNJ
       window.event.keyCode = 0x200C;
     else
       window.event.keyCode = farsikey[key - 0x0020];
     if (farsikey[key - 0x0020] == 92) {
        window.event.keyCode = 0x0698;
     }
     if (farsikey[key - 0x0020] == 8205) {
        window.event.keyCode = 0x067E;
     }
   }
   return true;
}

function change(obj){
if (lang==0)
lang=1
else
lang=0;
obj.focus();
}
///////////////////////// End Farsi Type ///////////////////////////////////////////////////////////////
