﻿    function getPositions(element){        
        var selectedPosX = 0;    
        var selectedPosY = 0; 
        while(element != null){
            selectedPosX += element.offsetLeft;
            selectedPosY += element.offsetTop;
            element = element.offsetParent;
        }
        return[selectedPosX,selectedPosY];
    }
        var browser=navigator.appName;
        var x = navigator;
    
    function formfirstopenbigpic(flag){        
        var agt=navigator.userAgent.toLowerCase();
        if (!flag){
            if (agt.indexOf("msie 6.") != -1){document.getElementById('form_budget').style.display = '';};
            document.getElementById('form_first_input_on').style.display = 'none';
            document.getElementById( "open_form_dd" ).style.display = '';document.getElementById( "open_form_dd_on" ).style.display = 'none';
            //if (browser=="Microsoft Internet Explorer"){document.getElementById('birthday_month').style.display = '';document.getElementById('form_second_p').style.paddingTop = '0px';}
            return;
        }
        var position = getPositions(document.getElementById('hcard-ECommerce-Partners'));

        document.getElementById( "open_form_dd" ).style.display = 'none';document.getElementById( "open_form_dd_on" ).style.display = '';
        if (agt.indexOf("opera") != -1){document.getElementById('form_first_input_on').style.top = Number(position[1]*1)-470 + 'px';document.getElementById('form_first_input_on').style.left = Number(position[0]+366) + 'px';document.getElementById('form_first_input_on').style.width = '400px';};
        if (agt.indexOf("safari") != -1){document.getElementById('form_first_input_on').style.top = Number(position[1]*1)-471 + 'px';document.getElementById('form_first_input_on').style.left = Number(position[0]+366) + 'px';document.getElementById('form_first_input_on').style.width = '402px';};
        if (agt.indexOf("firefox") != -1){document.getElementById('form_first_input_on').style.top = Number(position[1]*1)-471 + 'px';document.getElementById('form_first_input_on').style.left = Number(position[0]+366) + 'px';document.getElementById('form_first_input_on').style.width = '398px';};
        if (agt.indexOf("chrome") != -1){document.getElementById('form_first_input_on').style.top = Number(position[1]*1)-471 + 'px';document.getElementById('form_first_input_on').style.left = Number(position[0]+366) + 'px';document.getElementById('form_first_input_on').style.width = '399px';};
        if (agt.indexOf("msie 6.") != -1){document.getElementById('form_first_input_on').style.top = Number(position[1]*1)-474 + 'px';document.getElementById('form_first_input_on').style.left = Number(position[0]+364) + 'px';document.getElementById('form_first_input_on').style.width = '400px';document.getElementById('form_budget').style.display = 'none';};
        if (agt.indexOf("msie 7.") != -1){document.getElementById('form_first_input_on').style.top = Number(position[1]*1)-469 + 'px';document.getElementById('form_first_input_on').style.left = Number(position[0]+366) + 'px';document.getElementById('form_first_input_on').style.width = '400px';};
        
        document.getElementById('form_first_closer').style.display = '';document.getElementById('form_first_closer').style.top = Number(position[1]*1)-552 + 'px';document.getElementById('form_first_closer').style.left = Number(position[0]*1)+234 + 'px';
        document.getElementById('form_first_input_on').style.display = '';
    }
    
    function formfirstopencontact(flag){        
        var agt=navigator.userAgent.toLowerCase();
        if (!flag){
            if (agt.indexOf("msie 6.") != -1){document.getElementById('form_budget').style.display = '';};
            document.getElementById('form_first_input_on').style.display = 'none';
            document.getElementById( "open_form_dd" ).style.display = '';document.getElementById( "open_form_dd_on" ).style.display = 'none';
            //if (browser=="Microsoft Internet Explorer"){document.getElementById('birthday_month').style.display = '';document.getElementById('form_second_p').style.paddingTop = '0px';}
            return;
        }
        var position = getPositions(document.getElementById('hcard-ECommerce-Partners'));

        document.getElementById( "open_form_dd" ).style.display = 'none';document.getElementById( "open_form_dd_on" ).style.display = '';
        if (agt.indexOf("opera") != -1){document.getElementById('form_first_input_on').style.top = Number(position[1]*1)-470 + 'px';document.getElementById('form_first_input_on').style.left = Number(position[0]+335) + 'px';document.getElementById('form_first_input_on').style.width = '400px';};
        if (agt.indexOf("safari") != -1){document.getElementById('form_first_input_on').style.top = Number(position[1]*1)-465 + 'px';document.getElementById('form_first_input_on').style.left = Number(position[0]+335) + 'px';document.getElementById('form_first_input_on').style.width = '402px';};
        if (agt.indexOf("firefox") != -1){document.getElementById('form_first_input_on').style.top = Number(position[1]*1)-469 + 'px';document.getElementById('form_first_input_on').style.left = Number(position[0]+335) + 'px';document.getElementById('form_first_input_on').style.width = '398px';};
        if (agt.indexOf("chrome") != -1){document.getElementById('form_first_input_on').style.top = Number(position[1]*1)-469 + 'px';document.getElementById('form_first_input_on').style.left = Number(position[0]+335) + 'px';document.getElementById('form_first_input_on').style.width = '399px';};
        if (agt.indexOf("msie 6.") != -1){document.getElementById('form_first_input_on').style.top = Number(position[1]*1)-474 + 'px';document.getElementById('form_first_input_on').style.left = Number(position[0]+333) + 'px';document.getElementById('form_first_input_on').style.width = '400px';document.getElementById('form_budget').style.display = 'none';};
        if (agt.indexOf("msie 7.") != -1){document.getElementById('form_first_input_on').style.top = Number(position[1]*1)-469 + 'px';document.getElementById('form_first_input_on').style.left = Number(position[0]+335) + 'px';document.getElementById('form_first_input_on').style.width = '400px';};
        
        document.getElementById('form_first_closer').style.display = '';document.getElementById('form_first_closer').style.top = Number(position[1]*1)-552 + 'px';document.getElementById('form_first_closer').style.left = Number(position[0]*1)+234 + 'px';
        document.getElementById('form_first_input_on').style.display = '';
    }

    function formfirstopenpopup(flag){        
    var agt=navigator.userAgent.toLowerCase();
        if (!flag){
            if (agt.indexOf("msie 6.") != -1){document.getElementById('form_budget').style.display = '';};
            document.getElementById('form_first_input_on').style.display = 'none';
            document.getElementById( "open_form_dd" ).style.display = '';document.getElementById( "open_form_dd_on" ).style.display = 'none';
            return;
        }
        var position = getPositions(document.getElementById('ffi'));
        document.getElementById( "open_form_dd" ).style.display = 'none';document.getElementById( "open_form_dd_on" ).style.display = '';
        if (agt.indexOf("opera") != -1){document.getElementById('form_first_input_on').style.top = Number(position[1]*1)+18 + 'px';document.getElementById('form_first_input_on').style.left = Number(position[0]*1) + 'px';document.getElementById('form_first_input_on').style.width = '400px';};
        if (agt.indexOf("safari") != -1){document.getElementById('form_first_input_on').style.top = Number(position[1]*1)+18 + 'px';document.getElementById('form_first_input_on').style.left = Number(position[0]*1) + 'px';document.getElementById('form_first_input_on').style.width = '400px';};
        if (agt.indexOf("firefox") != -1){document.getElementById('form_first_input_on').style.top = Number(position[1]*1)+18 + 'px';document.getElementById('form_first_input_on').style.left = Number(position[0]*1) + 'px';document.getElementById('form_first_input_on').style.width = '398px';};
        if (agt.indexOf("chrome") != -1){document.getElementById('form_first_input_on').style.top = Number(position[1]*1)+18 + 'px';document.getElementById('form_first_input_on').style.left = Number(position[0]*1) + 'px';document.getElementById('form_first_input_on').style.width = '399px';};
        if (agt.indexOf("msie 6.") != -1){document.getElementById('form_first_input_on').style.top = Number(position[1]*1)+18 + 'px';document.getElementById('form_first_input_on').style.left = Number(position[0]*1) + 'px';document.getElementById('form_first_input_on').style.width = '399px';document.getElementById('form_budget').style.display = 'none';};
        if (agt.indexOf("msie 7.") != -1){document.getElementById('form_first_input_on').style.top = Number(position[1]*1)+18 + 'px';document.getElementById('form_first_input_on').style.left = Number(position[0]*1) + 'px';document.getElementById('form_first_input_on').style.width = '400px';};
        document.getElementById('form_first_closer').style.display = '';document.getElementById('form_first_closer').style.top = Number(position[1]*1)-60 + 'px';document.getElementById('form_first_closer').style.left = Number(position[0]*1)-134 + 'px';
        document.getElementById('form_first_input_on').style.display = '';
    }
    
    function formfirstopen(flag){        
        var agt=navigator.userAgent.toLowerCase();
        if (!flag){
            if (agt.indexOf("msie 6.") != -1){document.getElementById('form_budget').style.display = '';};
            document.getElementById('form_first_input_on').style.display = 'none';
            document.getElementById( "open_form_dd" ).style.display = '';document.getElementById( "open_form_dd_on" ).style.display = 'none';
            //if (browser=="Microsoft Internet Explorer"){document.getElementById('birthday_month').style.display = '';document.getElementById('form_second_p').style.paddingTop = '0px';}
            return;
        }
        var position = getPositions(document.getElementById('hcard-ECommerce-Partners'));

        document.getElementById( "open_form_dd" ).style.display = 'none';document.getElementById( "open_form_dd_on" ).style.display = '';
        if (agt.indexOf("opera") != -1){document.getElementById('form_first_input_on').style.top = Number(position[1]*1)-470 + 'px';document.getElementById('form_first_input_on').style.left = Number(position[0]+366) + 'px';document.getElementById('form_first_input_on').style.width = '400px';};
        if (agt.indexOf("safari") != -1){document.getElementById('form_first_input_on').style.top = Number(position[1]*1)-471 + 'px';document.getElementById('form_first_input_on').style.left = Number(position[0]+366) + 'px';document.getElementById('form_first_input_on').style.width = '402px';};
        if (agt.indexOf("firefox") != -1){document.getElementById('form_first_input_on').style.top = Number(position[1]*1)-471 + 'px';document.getElementById('form_first_input_on').style.left = Number(position[0]+366) + 'px';document.getElementById('form_first_input_on').style.width = '398px';};
        if (agt.indexOf("chrome") != -1){document.getElementById('form_first_input_on').style.top = Number(position[1]*1)-471 + 'px';document.getElementById('form_first_input_on').style.left = Number(position[0]+366) + 'px';document.getElementById('form_first_input_on').style.width = '399px';};
        if (agt.indexOf("msie 6.") != -1){document.getElementById('form_first_input_on').style.top = Number(position[1]*1)-482 + 'px';document.getElementById('form_first_input_on').style.left = Number(position[0]+364) + 'px';document.getElementById('form_first_input_on').style.width = '400px';document.getElementById('form_budget').style.display = 'none';};
        if (agt.indexOf("msie 7.") != -1){document.getElementById('form_first_input_on').style.top = Number(position[1]*1)-477 + 'px';document.getElementById('form_first_input_on').style.left = Number(position[0]+366) + 'px';document.getElementById('form_first_input_on').style.width = '400px';};
        
        document.getElementById('form_first_closer').style.display = '';document.getElementById('form_first_closer').style.top = Number(position[1]*1)-552 + 'px';document.getElementById('form_first_closer').style.left = Number(position[0]*1)+234 + 'px';
        document.getElementById('form_first_input_on').style.display = '';
    }


function formfirstclose(){
    document.getElementById('form_first_closer').style.display = 'none';
    var agt=navigator.userAgent.toLowerCase();
    if (agt.indexOf("msie 6.") != -1){document.getElementById('form_budget').style.display = '';};
    document.getElementById('form_first_input_on').style.display = 'none';
    document.getElementById( "open_form_dd" ).style.display = '';document.getElementById( "open_form_dd_on" ).style.display = 'none';
}

function chker(num){                                    
//alert(document.getElementById( "chk" + num ).checked);
var qstring = document.getElementById("ffi").value.replace("Please choose","");
//var qstring = qstring.replace("###","&#40;");
//var qstring = qstring.value.replace("####",")");
if(document.getElementById( "chk" + num ).checked == false){document.getElementById( "chk" + num ).checked = true;document.getElementById("ffi").value = (qstring + document.getElementById( "chk" + num ).value + '; ');}
else{document.getElementById( "chk" + num ).checked = false;document.getElementById("ffi").value = qstring.replace(document.getElementById( "chk" + num ).value + '; ',"");if(document.getElementById('ffi').value==""){document.getElementById('ffi').value = 'Please choose';}}

//document.getElementById( "chk" + num ) = true;}
}


function changeformbg(obj){                                    
            var qstring = document.getElementById("ffi").value.replace("Please choose","")
            if(obj.checked){
                //document.getElementById("ffi").style.background = 'url(/Bg/form_first_bg_on.jpg)';
                
                if(obj.getAttribute("value")!==""){document.getElementById("ffi").value = (qstring + obj.getAttribute("value") + '; ');}
                if(obj.getAttribute("value")==""){document.getElementById("ffi").value = (qstring + obj.getAttribute("value") + '; ');}

                
                //document.getElementById("ffi").value = obj.getAttribute("value");
            }
            if(!obj.checked){
            var qstring = document.getElementById('ffi').value;
            if(document.getElementById('ffi').value!==""){document.getElementById('ffi').value = qstring.replace(obj.getAttribute("value") + '; ',"")}
            if(document.getElementById('ffi').value==""){document.getElementById('ffi').value = 'Please choose';}
            }
            }
//if (ffi.value!==""){ffi.value= ffi.value + ';' + tag;}

function changeformbg2(num){                                    
            var qstring = document.getElementById("ffi").value.replace("Please choose","")
            if(document.getElementById( "chk" + num ).checked == true){
                //document.getElementById("ffi").style.background = 'url(/Bg/form_first_bg_on.jpg)';
                
                if(document.getElementById( "chk" + num ).value!==""){document.getElementById("ffi").value = (qstring + document.getElementById( "chk" + num ).value + '; ');}
                if(document.getElementById( "chk" + num ).value==""){document.getElementById("ffi").value = (qstring + document.getElementById( "chk" + num ).value + '; ');}

                
                //document.getElementById("ffi").value = obj.getAttribute("value");
            }
            if(!obj.checked){
            var qstring = document.getElementById('ffi').value;
            if(document.getElementById('ffi').value!==""){document.getElementById('ffi').value = qstring.replace(document.getElementById( "chk" + num ).value + '; ',"")}
            if(document.getElementById('ffi').value==""){document.getElementById('ffi').value = 'Please choose';}
            }
            }

function checkform(){
var x=0;
for (o = 1; o <= 4; o++){document.getElementById('formerr' + o).style.display='none';}
if(document.getElementById("name").value==""){document.getElementById('formerr2').style.display='';x++;};
if(document.getElementById("email").value==""){document.getElementById('formerr4').style.display='';x++;};
if(document.getElementById("phone").value==""){document.getElementById('formerr3').style.display='';x++;};
if (document.getElementById("email").value.indexOf("@")<0 || document.getElementById("email").value.indexOf(".")<0){document.getElementById('formerr4').style.display='';x++;}
//if ((document.getElementById('email').value=="") && (document.getElementById('email').value.indexOf("@")<0 || document.getElementById('email').value.indexOf(".")<0)){document.getElementById('formerr3').style.display='';x++;}
if (x>0){document.getElementById('formerr1').style.display=''};
if (x=="0"){document.xform.submit();};
}  

function checkerrorpopup(){
        var agt=navigator.userAgent.toLowerCase();
        var position = getPositions(document.getElementById('ffi'));
        if (agt.indexOf("opera") != -1){document.getElementById('formerr1').style.top = Number(position[1]*1)+120 + 'px';document.getElementById('formerr1').style.left = Number(position[0]*1)-114 + 'px';};
        if (agt.indexOf("safari") != -1){document.getElementById('formerr1').style.top = Number(position[1]*1)+120 + 'px';document.getElementById('formerr1').style.left = Number(position[0]*1)-114 + 'px';};
        if (agt.indexOf("firefox") != -1){document.getElementById('formerr1').style.top = Number(position[1]*1)+120 + 'px';document.getElementById('formerr1').style.left = Number(position[0]*1)-114 + 'px';};
        if (agt.indexOf("chrome") != -1){document.getElementById('formerr1').style.top = Number(position[1]*1)+120 + 'px';document.getElementById('formerr1').style.left = Number(position[0]*1)-114 + 'px';};
        if (agt.indexOf("msie 6.") != -1){document.getElementById('formerr1').style.top = Number(position[1]*1)+125 + 'px';document.getElementById('formerr1').style.left = Number(position[0]*1)-114 + 'px';};
        if (agt.indexOf("msie 7.") != -1){document.getElementById('formerr1').style.top = Number(position[1]*1)+120 + 'px';document.getElementById('formerr1').style.left = Number(position[0]*1)-114 + 'px';};
}