﻿function ShowDiv(img4h,img4s,divid) {
document.getElementById(img4h).style.display="none";
document.getElementById(img4s).style.display='';
document.getElementById(divid).style.display='';
} 
function HideDiv(img4h,img4s,divid) {
document.getElementById(img4h).style.display="none";
document.getElementById(img4s).style.display='';
document.getElementById(divid).style.display="none";
} 


//--------------------------------- SWF Controller ------------------------------------
var ic=0;
var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
function index_DoFSCommand(command, args)                {
  var indexObj = InternetExplorer ? index : document.index;
  //-------------------Login Cadr---------------------------------------
  //if(command=="LoginDataNull"){HideWaitLayer();alert(". خطا : تکمیل هر دو فیلد نام کاربری و رمز عبور الزامی است");}
 //alert(command);
 
 if(command=="OpenPartnershipForm"){
 window.open("PartnershipForm.aspx","PShipForm"+ic++,"width=700,height=500,top=10,left=10,toolsbar=no,menubar=yes,scrollbars=yes");
 }
 
 if(command=="OpenURL"){
 window.open(args,"PShipForm"+ic++,"width=1024,height=768,top=0,left=0,toolsbar=no,menubar=yes,scrollbars=yes");
 }
 
 if(command=="ShowContactForm") {ShowContactForm();}
 
 if(command=="HideContactForm") {HideContactForm();}
 
 if(command=="SendOK"){alert(". پیغام شما با موفقیت ارسال شد");}
 if(command=="SendNotOK"){alert(". خطا : متاسفانه در حال حاضر امکان انجام عملیات مورد نظر مقدور نمیباشد");}
 if(command=="SendNotOK"){alert(". خطا : پیغام ارسالی غیر مجاز است");}
 if(command=="OpenDownloadsPage"){
 window.open("ELearnDownloads.aspx","EDownloadPage"+ic++,"width=500,height=500,top=10,left=10,toolsbar=no,menubar=yes,scrollbars=yes");
 }
 
}
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && 
  navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
  document.write('<SCRIPT LANGUAGE=VBScript\> \n');
  document.write('On Error Resume Next \n');
  document.write('Sub index_FSCommand(ByVal command, ByVal args)\n');
  document.write(' call index_DoFSCommand(command, args)\n');
  document.write('end sub\n');
  document.write('</SCRIPT\> \n');
} 

//-------------------------------------------------------------------------------------

function OpenGMapWin() {
window.open("ChitoteckGMap_1.html","GMap","width=1024,height=768,top=0,left=0,menubar=yes");
}

var FlashLeft=(window.screen.width/2)-(766/2);
var MaxMode=false;
var MaxW=window.screen.width;
var MaxH=window.screen.height;
var LPert4C3 = InternetExplorer ? 326 : 140;

function ShowContactForm() {
//alert(FlashLeft);
//alert(window.innerHeight);
//alert(document.body.clientHeight);
MaxMode=true;
RiziseWin2Max();
var ContactFrm=document.getElementById("FormDiv");
ContactFrm.style.top="485px";

ContactFrm.style.left=(FlashLeft+LPert4C3)+"px";
ContactFrm.style.visibility="visible";
}

function RiziseWin2Max() {
if(((window.innerHeight<(MaxH-(MaxH/4))) || (window.innerwidth<(MaxW-(MaxW/4)))) || ((document.body.clientHeight<(MaxH-(MaxH/4))) || (document.body.clientWidth<(MaxW-(MaxW/4))))) {
window.moveTo(0,0);
window.resizeTo(MaxW,MaxH);
}
}

if(InternetExplorer) {
window.onresizeend = function(){
if(MaxMode==true){RiziseWin2Max();}
}
}else{
window.onresize = function(){
if(MaxMode==true){RiziseWin2Max();}
}
}

function HideContactForm() {
MaxMode=false;
var ContactFrm=document.getElementById("FormDiv");
ContactFrm.style.top="0px";
ContactFrm.style.left="0px";
ContactFrm.style.visibility="hidden";
}

function doPassVar(VarName,VarValue){
	//alert(document.getElementById("BGController2").id);
	window.document.index.SetVariable(VarName, VarValue);
	//document.getElementById("BGController2").SetVariable(VarName, VarValue);
}

function SendContactForm() {

//var mw = document.getElementById("if1");
//alert(mw.contentWindow.document.body.innerHTML );


var FullName=document.getElementById("FullNameTB").value;
var Email=document.getElementById("EmailTB").value;
var Tels=document.getElementById("TelsTB").value;
var PM=document.getElementById("PMTB").value;

var mw = document.getElementById("if1");
mw.contentWindow.document.getElementById("FullName").value=FullName;
mw.contentWindow.document.getElementById("Email").value=Email;
mw.contentWindow.document.getElementById("Phone").value=Tels;
mw.contentWindow.document.getElementById("PMText").value=PM;
//alert(mw.contentWindow.document.getElementById("PMText").value);
mw.contentWindow.document.getElementById("form1").submit();

//document.getElementById("if1").src="SendContactMail.aspx?FullName="+FullName+"&Email="+Email+"&Tels="+Tels+"&PM="+PM;
//doPassVar("FullName",FullName);
//doPassVar("Email",Email);
//doPassVar("Tels",Email);
//doPassVar("PM",PM);
//doPassVar("PageCommand","SendContactForm");
}
