﻿var qst;var row1 = document.getElementById("RadioRow1");var row2 = document.getElementById("RadioRow2"); var row3 = document.getElementById("RadioRow3"); var row4 = document.getElementById("RadioRow4");var stRes = document.getElementById("StepResult"); var qL = document.getElementById('_ctl0_cph__ctl0_advice_lblQst'); var tbl = document.getElementById("advice");var loadPnl = document.getElementById("ADLoadPanel");
function SendAdvice(cn){Loading("1");CallAdviceAsync(cn.valueOf());}function Loading(order){if(order == "0"){tbl.style.display = "block";loadPnl.style.display = "none";}else{tbl.style.display = "none";loadPnl.style.display = "block";} }function ShowRst(resultStr , context){if(resultStr.toString().indexOf("Step1Complete") != -1){row1.style.display = "none";row2.style.display = "none";row3.style.display = "none";row4.style.display = "none";
pQ.style.textAlign = "center";qst = qL.innerHTML;qL.innerHTML = "<br />از اظهار نظر شما متشکریم<br />";stRes.innerHTML = '<center><input type="button" id="btnReport" value="مشاهده گزارش" onclick="SendAdvice(this.id)"  style="font-family:Tahoma;font-size:small"/></center><br /><br />'; } else {pQ.style.textAlign = "justify";qL.innerHTML = qst;stRes.innerHTML = resultStr;} Loading("0");}
function onError(message , context){} var tReg = document.getElementById("tblRegMain");var tRegN = document.getElementById("tblRegisterN");var tRegName = document.getElementById('_ctl0_cph__ctl0_regnews_txtRegName');var tRegEmail = document.getElementById('_ctl0_cph__ctl0_regnews_txtRegEmail'); var trTag = document.getElementById("LoadReg");
var lblResult = document.getElementById('lblResult');function SendRegister(cn){if (ValidateRegForm() == false) return false;else{LoadingReg("1");CallRegNewsAsync(cn.valueOf()+"#"+tRegName.value+"#"+tRegEmail.value);}}function LoadingReg(order){if(order == "0"){tRegN.style.display = "block";trTag.style.display = "none";}else{tRegN.style.display = "none";trTag.style.display = "block";}}function ShowRegRst(resultStr , context)
{ lblResult.innerHTML = resultStr;LoadingReg("0");}function echeck(str) {var at="@";var dot=".";var lat=str.indexOf(at);var lstr=str.length;var ldot=str.indexOf(dot);if (str.indexOf(at)==-1){return false;}if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){return false;}if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){return false;
}if (str.indexOf(at,(lat+1))!=-1){return false;}if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){return false;}if (str.indexOf(dot,(lat+2))==-1){return false;}if (str.indexOf(" ")!=-1){return false; } return true;}   function ValidateRegForm(){if ((tRegName.value==null)||(tRegName.value=="")){ alert("!لطفاٌ نام خود را وارد کنید ");tRegName.focus();return false;}else if ((tRegEmail.value==null)||(tRegEmail.value=="")){alert("!لطفاٌ پست الکترونیکی خود را وارد کنید ");tRegEmail.focus();return false;} if (echeck(tRegEmail.value)==false){tRegEmail.value="";tRegEmail.focus();return false;}return true;}
var allHeights = new Array();var clhei = new Array();function Collapse(mode,td,act,speed){var tb = document.getElementById? document.getElementById(td):document.all?document.all[td]:document.layers[td];tdAct = act;picName = mode.src;picName = picName.substring(picName.lastIndexOf("/")+1);if(allHeights[act] == 0 || allHeights[act] == undefined){allHeights[act] = tb.offsetHeight?tb.offsetHeight:tb.clientHeight;}
if(picName == "up.jpg"){TDisplay(tb);clhei[act]= allHeights[act];action("Min",tb,act,speed);mode.src = mode.src.replace("up.jpg","down.jpg");}else{action("Max",tb,act,speed);mode.src = mode.src.replace("down.jpg","up.jpg");}}function TDisplay(td){for(f in td.childNodes){var mode = "none";if(td.childNodes[f].style){if(td.childNodes[f].style.display == "none"){mode = "block";}td.childNodes[f].style.display = mode;}}}
function action(mode,tb,act,speed){if(mode == "Min"){clhei[act] = clhei[act] - speed;if(clhei[act] < speed && clhei[act] > 0) clhei[act] = 0;if(clhei[act] >=0){tb.style.height =  clhei[act];setTimeout(function(){ action("Min",tb,act,speed)},5);}}else{ if(clhei[act] <= allHeights[act]){clhei[act] = clhei[act] + speed;if(clhei[act] > allHeights[act]) clhei[act] = allHeights[act];
tb.style.height =  clhei[act];setTimeout(function(){ action("Max",tb,act,speed)},5);}if(clhei[act] == allHeights[act]){TDisplay(tb);allHeights[act] = 0;}}}

