﻿// JScript File
function showSubMenu(strLI){
    var ele = $(strLI);
    //alert(ele.childNodes[1].nodeName);
    if(ele.childNodes[1].style){
        ele.childNodes[1].style.display="block";
        ele.childNodes[1].style.marginLeft=((130-ele.clientWidth)*-1) + "px";
    }
    else{
        ele.childNodes[3].style.display="block";
        ele.childNodes[3].style.marginLeft=((130-ele.offsetWidth)*-1) + "px";
    }
}
function CloseSubMenu(strLI){
    var ele = $(strLI);
    
    if(ele.childNodes[1].style){
        ele.childNodes[1].style.display="none";
    }
    else{
        ele.childNodes[3].style.display="none";
    }
}

//this function send site building request from user
function sendContact(){
    if($$("txtName")==""){alert("שם השולח הוא שדה חובה");return;}
    if(($$("txtTel")=="")&&($$("txtMobile")=="")){alert("אנא הזן לפחות שדה טלפון אחד");return;}
    
    var url="default.aspx?action=sendContact&name=" + $$("txtName") + "&tel=" + $$("txtTel") + "&mobile=" + $$("txtMobile") + "&Address=" + $$("txtAddress") + "&Mail=" + $$("txtMail") + "&CameFrom=" + $("cmbCameFrom").options[$("cmbCameFrom").selectedIndex].value + "&Interest=" + $("cmbInterest").options[$("cmbInterest").selectedIndex].value + "&Marks=" + $("txtMarks").innerHTML + "";
    
    KmDev.Ajax.openAjax(url);
}//end sendContact

//this function send cust help request from user
function sendCustHelp(){
    if($$("txtTopic")==""){alert("נושא הוא שדה חובה");return;}
    if($("txtMarks").innerHTML==""){alert("מהות הפנייה הוא שדה חובה");return;}
    if(($$("txtTel")=="")&&($$("txtMobile")=="")){alert("אנא הזן לפחות שדה טלפון אחד");return;}
    
    var url="default.aspx?action=sendCustHelp&name=" + $$("txtName") + "&tel=" + $$("txtTel") + "&mobile=" + $$("txtMobile") + "&topic=" + $$("txtTopic") + "&Mail=" + $$("txtMail") + "&custsite=" + $$("txtCustSite") + "&Marks=" + $("txtMarks").innerHTML + "";
    
    KmDev.Ajax.openAjax(url);
}// end sendCustHelp

//this function set the size of the float div to the size of the left div
function setSize(){
    KmDev.Ajax.openAjax('pagemonitoring.aspx?action=addUser&browser=' + navigator.appName + "&pagename=" + window.location);
    //alert($("leftBoxContent").clientHeight);
    var leftHeight = $("leftBoxContent").clientHeight;
    if(leftHeight<500){leftHeight=500;$("leftBoxContent").style.height=(leftHeight-20) + "px";}
    $("rightBox").style.height= leftHeight + "px";
    $("folatDivLeft").style.height= leftHeight + "px";
    $("folatDivMiddle").style.height= leftHeight + "px";
    $("folatDivRight").style.height= leftHeight + "px";
    $("floatDivBottom").style.top= leftHeight + "px";
}

function writeResult(sData){
    $("sResult").innerHTML=sData;
}
function cleanForm(){

    var loControls = document.getElementsByTagName("input");
    
    for(i=0,l=loControls.length-1;i<=l;i++){
        if(loControls[i].type=="text"){
            loControls[i].value="";
        }
    }
    
    var loControls = document.getElementsByTagName("textarea");
    
    for(i=0,l=loControls.length-1;i<=l;i++){
        if(loControls[i].type=="textarea"){
            loControls[i].innerHTML="";
        }
    }
    
    var loControls = document.getElementsByTagName("select");
    
    for(i=0,l=loControls.length-1;i<=l;i++){
        loControls[i].selectedIndex=0;
    }
}