Array.prototype.unique = function() {
    var r = new Array();
    for(var i=0,n=this.length;i<n;i++) {
        r[this[i]] = i;
    }
    var rr = new Array();
    count = 0;
    for(i in r) {
        rr[count] = i;
        count++;
    }
    return rr;
};
var widgetArray = new Array();
var widgetJsArray = new Array();
function compareEmail() {
    if(document.getElementById("Email").value == "") {
        alert(email_valid);
        return false;
    } else {
        if(document.getElementById("Email").value.indexOf("@",0) ==  - 1 || document.getElementById("Email").value.indexOf(".",0) ==  - 1) {
            alert(email_format);
            return false;
        }
    }
    if(document.getElementById("Email").value != document.getElementById("CnEmail").value) {
        alert(email_confirm);
        return false;
    } else {
        return true;
    }
}
function init_e() {
    isMozilla = (document.all)?0:1;
    if(isMozilla) {
        document.captureEvents(Event.MOUSEDOWN|Event.MOUSEMOVE|Event.MOUSEUP);
    }
}
init_e();
function checkmobile(obj,ob) {
    var pattern = /^[0-9]{10,12}$/;
    var valid = true;
    var mobile = document.getElementById(ob + "_ph_no");
    var sms = document.getElementById(ob + "_sms");
    if(sms.checked == true) {
        if( ! pattern.test(mobile.value)) {
            alert(click2call_mobileNumber_valid);
            mobile.focus();
            valid = false;
        }
    }
    if(valid) {
        if(document.getElementById(obj + "_verify").style.display == "block") {
            document.getElementById(obj + "_verify").innerHTML = "";
            document.getElementById("d_button").style.display = "block";
        }
    }
}
function checkcontact(obj,ob) {
    var pattern = /^[0-9]{10,12}$/;
    var valid = true;
    var mobile = document.getElementById(ob + "_ph_no");
    if( ! pattern.test(mobile.value)) {
        alert(mobile_valid);
        mobile.focus();
        valid = false;
    }
    if(valid) {
        if(document.getElementById(obj + "_verify").style.display == "block") {
            document.getElementById(obj + "_verify").innerHTML = "";
            document.getElementById("c_button").style.display = "block";
        }
    }
}
function check_Send_Email(frmId) {
    var frmObj = document.getElementById(frmId);
    var emails = document.getElementById("user_emails");
    if(emails.value != "") {
        var tmp_email = emails.value.split(",");
        for(var index=0;index<tmp_email.length;index++) {
            ind_email = trim(tmp_email[index]);
            if( ! checkValidEmail(ind_email)) {
                alert(emails_seperated);
                emails.focus();
                return false;
            }
        }
    } else {
        alert(emails_seperated);
        emails.focus();
        return false;
    }
    document.email.submit();
}
function submitcontact(obj,ob) {
    var frmObj = document.getElementById(obj);
    var valid = true;
    valid = checkValidContact(frmObj);
    if(valid) {
        var myblock = "<div align='left' style='padding-top:2px; padding-bottom:2px;background-color:#F3F8F8' ><div style='padding-left:20px; float:left;' class='gen_txt' id='ph_auth'> </div></div>";
        document.getElementById(obj + "_verify").innerHTML = myblock;
        if(document.getElementById(ob + "_user_ph_no").value != document.getElementById(ob + "_ph_no").value) {
            document.getElementById("c_button").style.display = "none";
            document.getElementById(obj + "_verify").style.display = "block";
            submitpopup_Activation(obj,ob);
        } else {
            document.contact.submit();
            document.getElementById(obj + "_verify").style.display = "block";
            var content = "<div align='left' style='padding-top:2px; padding-bottom:2px;background-color:#F3F8F8' ><div id='info'><div style='padding-left:20px; float:left;' class='login_field'><img src='/images/process.gif'/></div><div id='ph_auth'></div></div></div>";
            document.getElementById(obj + "_verify").innerHTML = content;
        }
    }
}
function submitrecommend(obj,ob) {
    var frmObj = document.getElementById(obj);
    var valid = true;
    if(ob == "r") {
        valid = validate_Sub_Recomed(frmObj);
    } else {
        if(ob == "r1") {
            valid = validate_Submit_Rec(obj);
        }
    }
    if(valid) {
        var login = document.getElementById("hid_login").value;
        if(login == "0" || login == "") {
            document.getElementById(ob + "_button").style.display = "none";
            var myblock = "<div align='center' style='padding-left:100px;float:left;'> <table align='left' style='padding-left:50px;'><tr><td align='left' colspan='2'><div id='l_error'style='padding-left:20px;'></div></td></tr><tr><td colspan='2' align='left' style='padding-top:2px;' class='login_field'><input type='checkbox' name='anonymus' id='anonymus' checked='true' />Send as Anonymous user</td></tr><tr><td style='padding-top:2px;' class='login_field'>User Name :</td><td><input id='d_loginid' name='d_loginid' onfocus=\"javascript:clearanonymus('" + obj + "');\" type='text' /></td></tr><tr><td style='padding-top:2px;' class='login_field'>Password :</td><td><input name='d_pwd' id='d_pwd' onfocus=\"javascript:clearanonymus('" + obj + "');\" type='password' /></td></tr><tr><td colspan='2' align='center'><a href='#' onclick=\"javascript:submitrec('" + obj + "' , '" + ob + "');\"><img src='/images/submit_but.gif' style='margin-top:10px;border:0' /></a></td></tr></table></div>";
            document.getElementById(obj + "_verify").style.display = "block";
            document.getElementById(obj + "_verify").innerHTML = myblock;
            return false;
        } else {
            if(obj == "rec1") {
                document.rec1.submit();
            } else {
                document.getElementById("rec_store1").submit();
            }
            var content = "<div align='left' style='padding-top:2px; padding-bottom:2px;background-color:#F3F8F8'><div id='info'><div style='padding-left:20px; float:left;' class='login_field'>Thank you for your Recommendation.</div><div id='ph_auth'></div></div></div>";
            document.getElementById(obj + "_verify").innerHTML = content;
        }
    }
}
function submitmobile(obj,ob) {
    var pattern = /^[0-9]{10,12}$/;
    var mobile = document.getElementById("m_ph_no");
    var valid = true;
    if( ! pattern.test(mobile.value)) {
        alert(mobile_valid);
        mobile.focus();
        valid = false;
    }
    if(valid) {
        var myblock = "<div align='left' style='padding-top:2px; padding-bottom:2px;' ><div style='padding-left:20px; float:left;' class='gen_txt' id='ph_auth'> </div></div>";
        document.getElementById(obj + "_verify").innerHTML = myblock;
        document.getElementById(ob + "_button").style.display = "none";
        document.getElementById(obj + "_verify").style.display = "block";
        submitpopup_Activation(obj,ob);
    }
}
function clickToCallOnPressingEnter(e,obj,ob) {
    if(e) {
        e = e;
    } else {
        e = window.event;
    }
    if(e.which) {
        var keycode = e.which;
    } else {
        var keycode = e.keyCode;
    }
    if(keycode == 13) {
        clickToCall(obj,ob);
    }
}
function clickToCall(obj,ob) {
    if(document.getElementById("sourceCode")) {
        var sourceCode = document.getElementById("sourceCode").value;
    }
    if(document.getElementById("sourceCode")) {
        var destinationCode = document.getElementById("destinationCode").value;
    }
    if(sourceCode == "SE") {
        var pattern = /^[0-9]{9,12}$/;
    } else {
        var pattern = /^[0-9]{10,12}$/;
    }
    var frmObj = document.getElementById(obj);
    var valid = true;
    var mobile = document.getElementById(ob + "_ph_no");
    if( ! pattern.test(mobile.value)) {
        alert(click2call_mobileNumber_valid);
        mobile.focus();
        valid = false;
    }
    if(valid) {
        checkPhNoAvailability(ob);
        var enteredNo = document.getElementById(ob + "_ph_no").value;
        var hidMobileStatus = document.getElementById(ob + "_hidMobileStatus").value;
        var c2c_ph_no = document.getElementById(ob + "_ph_no").value;
        var c2c_user_ph_no = document.getElementById(ob + "_user_ph_no").value;
        document.getElementById(ob + "_button").style.display = "none";
        if(document.getElementById("callWidgetId")) {
            var callWidgetId = document.getElementById("callWidgetId").value;
        }
        if(obj == "click2call_widget") {
            var myblock = "<div style='font-size: 11px; margin: 0px 5px;text-align:left; width: 200px' id='ph_auth_widget' class='ph_auth'></div>";
            document.getElementById(obj + "_verify").innerHTML = myblock;
            var ph_auth = document.getElementById("ph_auth_widget");
        } else {
            var myblock = "<div style='font-size: 11px; margin: 0px 5px;text-align:left; width: 200px' id='ph_auth'></div>";
            document.getElementById(obj + "_verify").innerHTML = myblock;
            var ph_auth = document.getElementById("ph_auth");
        }
        sleep(2000);
        var MobileNo = checkingEnteredPhoneNoAvailabity(enteredNo);
        if(hidMobileStatus == "true") {
            document.getElementById(obj + "_verify").style.display = "block";
            clickCall(document.getElementById(ob + "_merchant").value,document.getElementById(ob + "_vendorId").value,MobileNo,ph_auth,ob,callWidgetId);
        } else {
            if((c2c_ph_no != "") && (c2c_user_ph_no != c2c_ph_no)) {
                document.getElementById(obj + "_verify").style.display = "block";
                submitPopUpActivation(obj,ob,c2c_ph_no,ph_auth);
            } else {
                document.getElementById(obj + "_verify").style.display = "block";
                clickCall(document.getElementById(ob + "_merchant").value,document.getElementById(ob + "_vendorId").value,MobileNo,ph_auth,ob);
            }
        }
    }
}
function submitPopUpActivation(obj,ob,phoneNo,authDiv) {
    var mobile = phoneNo;
    if( ! mobile) {
        mobile = document.getElementById(ob + "_ph_no").value;
    }
    if(document.getElementById("sourceCode")) {
        var sourceCode = document.getElementById("sourceCode").value;
    }
    var enteredMobile;
    if(document.getElementById(ob + "_ph_no")) {
        enteredMobile = document.getElementById(ob + "_ph_no").value;
    }
    if( ! enteredMobile) {
        enteredMobile = phoneNo;
    }
    var mobile = checkingEnteredPhoneNoAvailabity(enteredMobile);
    var vendorId = "";
    if(document.getElementById(ob + "_vendorId") || document.getElementById(ob + "_vendorId") != undefined) {
        vendorId = document.getElementById(ob + "_vendorId").value;
    }
    if(document.getElementById("callWidgetId")) {
        var callWidgetId = document.getElementById("callWidgetId").value;
    }
    var xmlHttp;
    if(obj == "contact1") {
        var email = document.getElementById(ob + "_email").value;
        var name = document.getElementById(ob + "_username").value;
        if(ob == "hs" || ob == "dealWidget") {
            var url = "/business/sendActCode?mobile=" + mobile + "&email=" + email + "&name=" + name + "&from=DownLoadDealCoupon&businessId=" + vendorId;
        } else {
            if(ob == "c2c" || ob == "c2c_widget") {
                var url = "/business/sendActCode?mobile=" + mobile + "&email=" + email + "&name=" + name + "&from=ClickToCall&businessId=" + vendorId + "&sourceCode=" + sourceCode;
            } else {
                if(ob == "d" || ob == "dealAlertWidget") {
                    var url = "/business/sendActCode?mobile=" + mobile + "&email=" + email + "&name=" + name + "&from=DealAlert&businessId=" + vendorId;
                } else {
                    var url = "/business/sendActCode?mobile=" + mobile + "&email=" + email + "&name=" + name + "&businessId=" + vendorId;
                }
            }
        }
    } else {
        var email = "";
        if(ob == "d" || ob == "dealAlertWidget") {
            email = document.getElementById(ob + "_EmailId").value;
        } else {
            email = document.getElementById(ob + "_userEmailId").value;
        }
        var mobileStatus = document.getElementById(ob + "_hidMobileStatus").value;
        if(email != "") {
            if(ob == "hs" || ob == "dealWidget") {
                var url = "/business/sendActCode?mobile=" + mobile + "&email=" + email + "&from=DownLoadDealCoupon&businessId=" + vendorId + "&mobileStatus=" + mobileStatus;
            } else {
                if(ob == "c2c" || ob == "c2c_widget") {
                    var url = "/business/sendActCode?mobile=" + mobile + "&email=" + email + "&from=ClickToCall&businessId=" + vendorId + "&mobileStatus=" + mobileStatus + "&sourceCode=" + sourceCode;
                } else {
                    if(ob == "d" || ob == "dealAlertWidget") {
                        var url = "/business/sendActCode?mobile=" + mobile + "&email=" + email + "&from=DealAlert&businessId=" + vendorId + "&mobileStatus=" + mobileStatus;
                    } else {
                        var url = "/business/sendActCode?mobile=" + mobile + "&email=" + email + "&businessId=" + vendorId + "&mobileStatus=" + mobileStatus;
                    }
                }
            }
        } else {
            if(ob == "hs" || ob == "dealWidget") {
                var url = "/business/sendActCode?mobile=" + mobile + "&from=DownLoadDealCoupon&businessId=" + vendorId + "&mobileStatus=" + mobileStatus;
            } else {
                if(ob == "c2c" || ob == "c2c_widget") {
                    var url = "/business/sendActCode?mobile=" + mobile + "&from=ClickToCall&businessId=" + vendorId + "&mobileStatus=" + mobileStatus + "&sourceCode=" + sourceCode;
                } else {
                    if(ob == "d" || ob == "dealAlertWidget") {
                        var url = "/business/sendActCode?mobile=" + mobile + "&from=DealAlert&businessId=" + vendorId + "&mobileStatus=" + mobileStatus;
                    } else {
                        var url = "/business/sendActCode?mobile=" + mobile + "&businessId=" + vendorId + "&mobileStatus=" + mobileStatus;
                    }
                }
            }
        }
    }
    try {
        xmlHttp = new XMLHttpRequest();
    } catch(e) {
        try {
            xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch(e) {
            try {
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch(e) {
                alert(browser_support);
                return false;
            }
        }
    }
    xmlHttp.onreadystatechange = function() {
        authDiv.innerHTML = "<img src='/images/processing.gif' style='margin:40px 0px 0px 40px;'>";
        if(xmlHttp.readyState == 4) {
            var response = xmlHttp.responseText;
            if(response) {
                if(sourceCode == "IN") {
                    document.getElementById(ob + "_userId").value = response;
                    var myblock = "<div id='" + ob + "_smsErrors' style='display:none;line-height:10px;margin:5px 0px 0px 5px;'></div><div class='activationcodediv'><div>Your mobile number has not been authenticated. Enter four digit code SMSed to your mobile</div><div align='left' style='padding-left: 0px; padding-top: 0px'>Enter the code :&nbsp;<input size='4' type='text' style='width:35px' id='act_no' name='number' /><input type='hidden' id='ph_no' value='" + mobile + "' />&nbsp;<input type='button' name='button' value='Ok' onclick=\"javascript:activatePopup('" + obj + "' , '" + ob + "' , '" + enteredMobile + "','" + authDiv + "','" + callWidgetId + "');\" /></div></div>";
                    authDiv.innerHTML = myblock;
                } else {
                    clickCall(document.getElementById(ob + "_merchant").value,document.getElementById(ob + "_vendorId").value,mobile,authDiv,ob);
                }
            }
        }
    };
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}
function activatePopup(obj,ob,enteredPhoneNo,authDiv,callWidgetId) {
    var act_no = document.getElementById("act_no").value;
    if( ! enteredPhoneNo) {
        enteredPhoneNo = document.getElementById(ob + "_ph_no").value;
    }
    if(enteredPhoneNo == "") {
        enteredPhoneNo = document.getElementById("ph_no").value;
    }
    var ph_no = checkingEnteredPhoneNoAvailabity(enteredPhoneNo);
    var xmlHttp;
    try {
        xmlHttp = new XMLHttpRequest();
    } catch(e) {
        try {
            xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch(e) {
            try {
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch(e) {
                alert(browser_support);
                return false;
            }
        }
    }
    xmlHttp.onreadystatechange = function() {
        if(xmlHttp.readyState == 4) {
            if(parseInt(xmlHttp.responseText) == "1") {
                document.getElementById(ob + "_user_ph_no").value = ph_no;
                var myblock = "<div class='statusdiv'>Your mobile number is now successfully authenticated<br/>";
                if(obj == "sdeal" || obj == "dealWidget") {
                    myblock += "<img src='/images/ajax-loader.gif'/>Submitting your Deal</div>";
                    alert(dealAlert_set);
                } else {
                    if(obj == "hotsms" || obj == "hotsms_widget") {
                        myblock += "<img src='/images/ajax-loader.gif'/>Submitting your request</div>";
                        alert("The deal has been sent to your mobile as an SMS.");
                        window.location.reload();
                    } else {
                        if(obj == "click2call" || obj == "click2call_widget") {
                            myblock += "<img src='/images/processing.gif' style='margin:0px 0px 0px 40px;'/>";
                        } else {
                            if(obj == "frm_mobile") {
                                myblock += "<div style='float:left; padding-left:8px;'><input type='button' value='Close' style='border:0' onclick='javascript:tb_remove();return false;'/></div></div>";
                            }
                        }
                    }
                }
                if(document.getElementById("info")) {
                    document.getElementById("info").innerHTML = myblock;
                    if(obj == "click2call" || obj == "click2call_widget") {
                        clickCall(document.getElementById(ob + "_merchant").value,document.getElementById(ob + "_vendorId").value,ph_no,authDiv,ob,callWidgetId);
                    }
                } else {
                    if(ob == "c2c") {
                        document.getElementById("ph_auth").innerHTML = myblock;
                    } else {
                        if(document.getElementById("ph_auth_widget")) {
                            document.getElementById("ph_auth_widget").innerHTML = myblock;
                        } else {
                            authDiv.innerHTML = myblock;
                        }
                    }
                    if(obj == "click2call" || obj == "click2call_widget") {
                        clickCall(document.getElementById(ob + "_merchant").value,document.getElementById(ob + "_vendorId").value,ph_no,authDiv,ob,callWidgetId);
                    }
                }
            } else {
                var myblock = xmlHttp.responseText;
                document.getElementById(ob + "_smsErrors").style.display = "block";
                document.getElementById(ob + "_smsErrors").innerHTML = myblock;
            }
        }
    };
    var uid = document.getElementById(ob + "_userId").value;
    var from = document.getElementById(ob + "_from").value;
    if(from == "external") {
        var dealId = document.getElementById(ob + "_dealId").value;
        var source = document.getElementById(ob + "_source").value;
        var MobileNo = checkingEnteredPhoneNoAvailabity(enteredPhoneNo);
        var url = "/business/mobileActivate?activation_code=" + act_no + "&mobile=" + ph_no + "&uid=" + uid + "&dealId=" + dealId + "&from=" + from + "&source=" + source;
    } else {
        var url = "/business/mobileActivate?activation_code=" + act_no + "&mobile=" + ph_no + "&uid=" + uid;
    }
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}
function sleep(delay) {
    var start = new Date().getTime();
    while(new Date().getTime() < start + delay) {}
}
function clickCall(m_number,vendorId,u_number,authDiv,ob,callWidgetId) {
    var source = document.getElementById(ob + "_source").value;
    var campaignId = document.getElementById("bannerAdCampaignId").value;
    if(document.getElementById("sourceCode")) {
        var sourceCode = document.getElementById("sourceCode").value;
    }
    if(document.getElementById("destinationCode")) {
        var destinationCode = document.getElementById("destinationCode").value;
    }
    if(document.getElementById(ob + "_from")) {
        var from = document.getElementById(ob + "_from").value;
    }
    if(document.getElementById("adId")) {
        var adId = document.getElementById("adId").value;
    }
    if(document.getElementById("widgetId")) {
        var widgetId = document.getElementById("widgetId").value;
    }
    if(document.getElementById("micrositeId")) {
        var micrositeId = document.getElementById("micrositeId").value;
    }
    if(document.getElementById("pageName")) {
        var pageName = document.getElementById("pageName").value;
    }
    if(document.getElementById("bizgainCampaignName")) {
        var bizgainCampaignName = document.getElementById("bizgainCampaignName").value;
    }
    if(document.getElementById("adChannelName")) {
        var adChannelName = document.getElementById("adChannelName").value;
    }
    if(document.getElementById("adCampaignName")) {
        var adCampaignName = document.getElementById("adCampaignName").value;
    }
    if(document.getElementById("adGroupName")) {
        var adGroupName = document.getElementById("adGroupName").value;
    }
    if(document.getElementById("adIdentifier")) {
        var adIdentifier = document.getElementById("adIdentifier").value;
    }
    var xmlHttp;
    try {
        xmlHttp = new XMLHttpRequest();
    } catch(e) {
        try {
            xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch(e) {
            try {
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch(e) {
                alert(browser_support);
                return false;
            }
        }
    }
    xmlHttp.onreadystatechange = function() {
        authDiv.innerHTML = "<img src='/images/processing.gif' style='margin:40px 0px 0px 40px;'/>";
        if(xmlHttp.readyState == 4) {
            var sid = trim(xmlHttp.responseText);
            if(sid == "block") {
                authDiv.innerHTML = "";
                alert(black_mobile_message);
                window.location.reload();
            } else {
                var sidValues = new Array();
                sidValues = sid.split("*");
                if(trim(sidValues[0]," ") == "ClickCall") {
                    clickCallStatus(sidValues[1],u_number,authDiv,ob,source,vendorId,callWidgetId);
                }
                if(trim(sidValues[0]," ") == "Escube") {
                    escubeStatus(sidValues[1],u_number,authDiv,ob,source,vendorId,callWidgetId);
                }
                if(trim(sidValues[0]," ") == "Twilio") {
                    twilioStatus(sidValues[1],u_number,authDiv,ob,source,vendorId,callWidgetId);
                }
            }
        }
    };
    var url = "/click2call/" + m_number + "/" + vendorId + "?u_number=" + u_number + "&source=" + source + "&from=" + from + "&adId=" + adId + "&sourceCode=" + sourceCode + "&destinationCode=" + destinationCode + "&widgetId=" + widgetId + "&micrositeId=" + micrositeId + "&campaignId=" + campaignId + "&pageName=" + pageName + "&bizgainCampaignName=" + bizgainCampaignName + "&adChannelName=" + adChannelName + "&adCampaignName=" + adCampaignName + "&adGroupName=" + adGroupName + "&adIdentifier=" + adIdentifier;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}
function trim(str,chars) {
    return ltrim(rtrim(str,chars),chars);
}
function ltrim(str,chars) {
    chars = chars || "\\s";
    return str.replace(new RegExp("^[" + chars + "]+","g"),"");
}
function rtrim(str,chars) {
    chars = chars || "\\s";
    return str.replace(new RegExp("[" + chars + "]+$","g"),"");
}
function escubeStatus(sid,u_number,authDiv,ob,source,vendorId,callWidgetId) {
    var escubeCallStatusArray = new Array("Your mobile is ringing","Merchant mobile is ringing","You accepted the call","Merchant accepted the call","Call connected ","Call disconnected","Your are busy in a call"," Merchant is busy in a call","Your number is wrong","Merchant number is wrong");
    var check_escube_status = new Array();
    var status_id = sid;
    var xmlHttp;
    try {
        xmlHttp = new XMLHttpRequest();
    } catch(e) {
        try {
            xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch(e) {
            try {
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch(e) {
                alert(browser_support);
                return false;
            }
        }
    }
    xmlHttp.onreadystatechange = function() {
        if(xmlHttp.readyState == 4) {
            var from = ob;
            var len = check_escube_status.length;
            check_escube_status[len] = trim(xmlHttp.responseText);
            if(authDiv) {
                var clickToCallStatus = trim(xmlHttp.responseText);
                if(clickToCallStatus == "Call" && source == "Microsite") {
                    authDiv.innerHTML = "";
                    document.click2callForm.action = "/showLandingPage/" + vendorId + "?from=Call";
                    document.click2callForm.submit();
                } else {
                    if(clickToCallStatus == "sms") {
                        escubeStatus(sid,u_number,authDiv,ob,source,vendorId,callWidgetId);
                    } else {
                        if(parseInt(clickToCallStatus) >= 5) {
                            updateEscubeStatus(sid,u_number);
                            authDiv.innerHTML = "<div style='padding-top: 10px' align='center' class='statusdiv'>" + escubeCallStatusArray[parseInt(clickToCallStatus)] + "<br/><input type='button' value='Close' onclick=javascript:closePopup('" + ob + "');return false;/></div>";
                        } else {
                            if(parseInt(clickToCallStatus) < 5) {
                                authDiv.innerHTML = escubeCallStatusArray[parseInt(clickToCallStatus)];
                                escubeStatus(sid,u_number,authDiv,ob,source,vendorId,callWidgetId);
                            } else {
                                document.getElementById("ph_auth").innerHTML = "All lines are busy.Please try after some time.<br/><input type='button' value='Close' onclick=javascript:closePopup('" + ob + "');return false;/>";
                                return false;
                            }
                        }
                    }
                }
            }
        }
    };
    xmlHttp.open("GET","/escubeStatus/" + sid + "?widgetId=" + callWidgetId,true);
    xmlHttp.send(null);
}
function updateEscubeStatus(status_id,u_number) {
    var xmlHttp;
    try {
        xmlHttp = new XMLHttpRequest();
    } catch(e) {
        try {
            xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch(e) {
            try {
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch(e) {
                alert(browser_support);
                return false;
            }
        }
    }
    xmlHttp.onreadystatechange = function() {
        if(xmlHttp.readyState == 4) {
            var sid = trim(xmlHttp.responseText);
        }
    };
    var url = "/escubeStatusUpdate/" + status_id;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}
function clickCallStatus(sid,u_number,authDiv,ob,source,vendorId,callWidgetId,i) {
    var sourceIsdCode = document.getElementById("sourceIsdCode").value;
    var destinationIsdCode = document.getElementById("destinationIsdCode").value;
    if(i == "") {
        var j = 0;
    }
    var callStatusArray = new Array("Your number has been dialled and should be ringing.","Your phone is connected now.","Your phone is connected now.<br>Call disconnected from Merchant.","Call to your number has been submitted successfully.","Your phone is connected now.<br>Merchant could not be contacted, you are being transferred to voicemail.","Your phone is connected now.<br>Merchant is connected now.","Call has ended successfully.","Your number could not be contacted, call ended.");
    var check_status = new Array();
    var status_id = sid;
    var xmlHttp;
    try {
        xmlHttp = new XMLHttpRequest();
    } catch(e) {
        try {
            xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch(e) {
            try {
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch(e) {
                alert(browser_support);
                return false;
            }
        }
    }
    xmlHttp.onreadystatechange = function() {
        if(xmlHttp.readyState == 4) {
            var from = ob;
            var len = check_status.length;
            check_status[len] = trim(xmlHttp.responseText);
            if(authDiv) {
                var clickToCallStatus = trim(xmlHttp.responseText);
                if(clickToCallStatus == "Call" && source == "Microsite") {
                    authDiv.innerHTML = "";
                    document.click2callForm.action = "/showLandingPage/" + vendorId + "?from=Call";
                    document.click2callForm.submit();
                } else {
                    if(clickToCallStatus == "sms") {
                        count = 0;
                        clickCallStatus(sid,u_number,authDiv,ob,source,vendorId,callWidgetId,j);
                        if(count == 3) {
                            authDiv.innerHTML = "Due to Error in the connection,SMS sent to merchant.<br/><input type='button' value='Close' onclick=javascript:closePopup('" + ob + "');return false;/>";
                        } else {
                            count++;
                        }
                    } else {
                        if(parseInt(clickToCallStatus) == 6 || parseInt(clickToCallStatus) == 7) {
                            updateClickCallStatus(sid,u_number);
                            var isFromFacebook = document.getElementById("from").value;
                            if(document.getElementById("userFbId")) {
                                var userFbId = document.getElementById("userFbId").value;
                            }
                            if(document.getElementById("fanPageUrl")) {
                                var fanPageUrl = document.getElementById("fanPageUrl").value;
                            }
                            if(document.getElementById("businessName")) {
                                var businessName = document.getElementById("businessName").value;
                            }
                            if(isFromFacebook == "Facebook") {
                                authenticateFacebookUser("ClickToCall",userFbId,businessName,fanPageUrl,"");
                            }
                            authDiv.innerHTML = "<div style='padding-top: 10px' align='center' class='statusdiv'>" + callStatusArray[parseInt(clickToCallStatus)] + "<br/><input type='button' value='Close' style='cursor:pointer;' onclick=javascript:closePopup('" + ob + "');return false;/></div>";
                        } else {
                            if(parseInt(clickToCallStatus) < 6) {
                                authDiv.innerHTML = callStatusArray[parseInt(clickToCallStatus)];
                                clickCallStatus(sid,u_number,authDiv,ob,source,vendorId,callWidgetId);
                            } else {
                                authDiv.innerHTML = "All lines are busy.Please try after some time.<br/><input type='button' value='Close' onclick=javascript:closePopup('" + ob + "');return false;/>";
                                return false;
                            }
                        }
                    }
                }
            }
        }
    };
    xmlHttp.open("GET","/clickCallStatus/" + sid + "?u_number=" + u_number + "&widgetId=" + callWidgetId + "&destinationIsdCode=" + destinationIsdCode + "&sourceIsdCode=" + sourceIsdCode,true);
    xmlHttp.send(null);
}
function updateClickCallStatus(status_id,u_number) {
    var xmlHttp;
    try {
        xmlHttp = new XMLHttpRequest();
    } catch(e) {
        try {
            xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch(e) {
            try {
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch(e) {
                alert(browser_support);
                return false;
            }
        }
    }
    xmlHttp.onreadystatechange = function() {
        if(xmlHttp.readyState == 4) {
            var sid = trim(xmlHttp.responseText);
        }
    };
    var url = "/ClickCallStatusUpdate/" + status_id + "?u_number=" + u_number;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}
function twilioStatus(sid,u_number,authDiv,ob,source,vendorId,callWidgetId) {
    var twilioCallStatusArray = new Array("The call is ready and waiting in line before going out","The call is currently ringing","The call was answered and is currently in progress","The call was answered and has ended normally","The caller received a busy signal","The call could not be completed as dialed, most likely because the phone number was non-existent","The call ended without being answered"," The call was canceled while queued or ringing");
    var check_twilio_status = new Array();
    var status_id = sid;
    var xmlHttp;
    try {
        xmlHttp = new XMLHttpRequest();
    } catch(e) {
        try {
            xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch(e) {
            try {
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch(e) {
                alert(browser_support);
                return false;
            }
        }
    }
    xmlHttp.onreadystatechange = function() {
        if(xmlHttp.readyState == 4) {
            var from = ob;
            var len = check_twilio_status.length;
            check_twilio_status[len] = trim(xmlHttp.responseText);
            if(authDiv) {
                var clickToCallStatus = trim(xmlHttp.responseText);
                if(clickToCallStatus == "Call" && source == "Microsite") {
                    authDiv.innerHTML = "";
                    document.click2callForm.action = "/showLandingPage/" + vendorId + "?from=Call";
                    document.click2callForm.submit();
                } else {
                    if(clickToCallStatus == "sms") {
                        escubeStatus(sid,u_number,authDiv,ob,source,vendorId,callWidgetId);
                        authDiv.innerHTML = "Due to Error in the connection,SMS sent to merchant";
                    } else {
                        if(parseInt(clickToCallStatus) >= 3) {
                            updateTwilioStatus(sid,u_number);
                            authDiv.innerHTML = "<div style='padding-top: 10px' align='center' class='statusdiv'>" + twilioCallStatusArray[parseInt(clickToCallStatus)] + "<br/><input type='button' value='Close' onclick=javascript:closePopup('" + ob + "');return false;/></div>";
                        } else {
                            if(parseInt(clickToCallStatus) < 3) {
                                authDiv.innerHTML = twilioCallStatusArray[parseInt(clickToCallStatus)];
                                twilioStatus(sid,u_number,authDiv,ob,source,vendorId,callWidgetId);
                            } else {
                                document.getElementById("ph_auth").innerHTML = "All lines are busy.Please try after some time.<br/><input type='button' value='Close' onclick=javascript:closePopup('" + ob + "');return false;/>";
                                return false;
                            }
                        }
                    }
                }
            }
        }
    };
    xmlHttp.open("GET","/twilioStatus/" + sid + "?widgetId=" + callWidgetId,true);
    xmlHttp.send(null);
}
function updateTwilioStatus(status_id,u_number) {
    var xmlHttp;
    try {
        xmlHttp = new XMLHttpRequest();
    } catch(e) {
        try {
            xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch(e) {
            try {
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch(e) {
                alert(browser_support);
                return false;
            }
        }
    }
    xmlHttp.onreadystatechange = function() {
        if(xmlHttp.readyState == 4) {
            var sid = trim(xmlHttp.responseText);
        }
    };
    var url = "/twilioStatusUpdate/" + status_id;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}
function checkValidDealAlert(frmObj,ob) {
    var pattern = /^[0-9]{10,12}$/;
    var valid = true;
    var mobile = document.getElementById(ob + "_ph_no");
    var sms = document.getElementById("sms");
    var ntemail = document.getElementById(ob + "_ntemail");
    var days = document.getElementById(ob + "_days");
    var dataOk = true;
    if(sms.checked != true && ntemail.checked != true) {
        alert(alert_type);
        valid = false;
        dataOk = false;
    } else {
        dataOk = true;
    }
    if(dataOk == true) {
        if(days.value == 0) {
            alert(select_days);
            days.focus();
            valid = false;
            dataOk = false;
        } else {
            dataOk = true;
        }
    }
    if(dataOk == true) {
        if(sms.checked == true) {
            if(mobile.value == "") {
                alert(click2call_mobileNumber_valid);
                mobile.focus();
                valid = false;
                dataOk = false;
            } else {
                if( ! pattern.test(mobile.value) || mobile.value.length > 13) {
                    alert(click2call_mobileNumber_valid);
                    mobile.focus();
                    valid = false;
                    dataOk = false;
                } else {
                    document.getElementById(ob + "_sms").value = "sms";
                    dataOk = true;
                }
            }
        } else {
            document.getElementById(ob + "_sms").value = "";
        }
    }
    if(dataOk == true) {
        if(ntemail.checked == true) {
            if(document.getElementById("divDealAlertEmail").style.display == "block") {
                if( ! document.getElementById(ob + "_EmailId").disabled) {
                    if(document.getElementById(ob + "_EmailId").value == "") {
                        alert(email_forgotPassword_required);
                        document.getElementById(ob + "_EmailId").focus();
                        valid = false;
                        dataOk = false;
                    } else {
                        if(document.getElementById(ob + "_EmailId").value != "") {
                            if( ! validateEmail(ob + "_EmailId")) {
                                dataOk = false;
                            } else {
                                dataOk = true;
                            }
                        }
                    }
                }
            }
        }
    }
    if(ntemail.checked == true) {
        document.getElementById(ob + "_mail").value = "mail";
    } else {
        document.getElementById(ob + "_mail").value = "";
    }
    if(dataOk == true) {
        return valid;
    }
}
function submitSetDealAlert(obj,ob) {
    var frmObj = document.getElementById(obj);
    var u_mobile = document.getElementById(ob + "_ph_no").value;
    var u_email = document.getElementById(ob + "_EmailId").value;
    var b_id = document.getElementById(ob + "_stores_ids").value;
    var u_cat = document.getElementById(ob + "_categoryList").value;
    var u_days = document.getElementById(ob + "_days").value;
	if(document.getElementById(ob + "_micrositeId").value)
	{
		var micrositeId = document.getElementById(ob + "_micrositeId").value;
	}
    var valid = true;
    if(ob == "d" || ob == "dealAlertWidget") {
        valid = checkValidDealAlert(frmObj,ob);
    }
    if(valid) {
        checkPhNoAvailability(ob);
        if(obj == "sdeal") {
            var myblock = "<div style='font-size:11px;' id='ph_auth'></div>";
            document.getElementById(obj + "_verify").innerHTML = myblock;
            document.getElementById(ob + "_button").style.display = "none";
            var ph_auth = document.getElementById("ph_auth");
        } else {
            if(obj == "sdeal_widget") {
                var myblock = "<div style='font-size:11px;' id='dealAlert_auth_widget' class='ph_auth'></div>";
                document.getElementById(obj + "_verify").innerHTML = myblock;
                document.getElementById(ob + "_button").style.display = "none";
                var ph_auth = document.getElementById("dealAlert_auth_widget");
            }
        }
        sleep(2000);
        if(document.getElementById(ob + "_hidMobileStatus").value == "true") {
            if(obj == "sdeal") {
                var content = "<div align='left' ><div id='info'><div style='padding-left:20px; float:left;' class='login_field'>Deal alert on your mobile was set</div><div id='ph_auth'></div></div></div>";
                var ph_auth = document.getElementById("ph_auth");
                sendDealAlert(u_mobile,u_email,b_id,u_cat,u_days,ph_auth,ob,micrositeId);
            } else {
                if(obj == "sdeal_widget") {
                    var content = "<div align='left' ><div id='info'><div style='padding-left:20px; float:left;' class='login_field'>Deal alert on your mobile was set</div><div id='dealAlert_auth_widget' class='ph_auth'></div></div></div>";
                    var ph_auth = document.getElementById("dealAlert_auth_widget");
                    sendDealAlert(u_mobile,u_email,b_id,u_cat,u_days,ph_auth,ob,micrositeId);
                }
            }
        } else {
            if((document.getElementById(ob + "_ph_no").value != "") && (document.getElementById(ob + "_user_ph_no").value != document.getElementById(ob + "_ph_no").value)) {
                document.getElementById(obj + "_verify").style.display = "block";
                submitPopUpActivation(obj,ob,"",ph_auth);
            } else {
                if(obj == "sdeal") {
                    var content = "<div align='left' ><div id='info'><div style='padding-left:20px; float:left;' class='login_field'>Deal alert on your mobile was set</div><div id='ph_auth'></div></div></div>";
                    var ph_auth = document.getElementById("ph_auth");
                    sendDealAlert(u_mobile,u_email,b_id,u_cat,u_days,ph_auth,ob,micrositeId);
                } else {
                    if(obj == "sdeal_widget") {
                        var content = "<div align='left' ><div id='info'><div style='padding-left:20px; float:left;' class='login_field'>Deal alert on your mobile was set</div><div id='dealAlert_auth_widget' class='ph_auth'></div></div></div>";
                        var ph_auth = document.getElementById("dealAlert_auth_widget");
                        sendDealAlert(u_mobile,u_email,b_id,u_cat,u_days,ph_auth,ob,micrositeId);
                    }
                }
            }
        }
    }
}
function sendDealAlert(u_mobile,u_email,b_id,u_cat,u_days,ph_auth,ob,micrositeId) {
    var source = document.getElementById(ob + "_source").value;
	if(document.getElementById("pageName")) {
        var pageName = document.getElementById("pageName").value;
    }
    if(document.getElementById("bizgainCampaignName")) {
        var bizgainCampaignName = document.getElementById("bizgainCampaignName").value;
    }
    if(document.getElementById("adChannelName")) {
        var adChannelName = document.getElementById("adChannelName").value;
    }
    if(document.getElementById("adCampaignName")) {
        var adCampaignName = document.getElementById("adCampaignName").value;
    }
    if(document.getElementById("adGroupName")) {
        var adGroupName = document.getElementById("adGroupName").value;
    }
    if(document.getElementById("adIdentifier")) {
        var adIdentifier = document.getElementById("adIdentifier").value;
    }
	if(document.getElementById(ob+"_from")) {
        var from = document.getElementById(ob+"_from").value;
    }
    var xmlHttp;
    try {
        xmlHttp = new XMLHttpRequest();
    } catch(e) {
        try {
            xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch(e) {
            try {
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch(e) {
                alert(browser_support);
                return false;
            }
        }
    }
    xmlHttp.onreadystatechange = function() {
        ph_auth.innerHTML = "<img src='/images/processing.gif' style='margin:0px 0px 0px 90px;'>";
        if(xmlHttp.readyState == 4) {
            var response = xmlHttp.responseText;
            if(trim(response) == "BlackList") {
                ph_auth.innerHTML = "";
                alert(black_mobile_message);
                closeDealAlertPopup();
            } else {
                if(trim(response) != "") {
                    ph_auth.innerHTML = "";
                    alert(dealAlert_set);
                    closeDealAlertPopup();
                }
            }
        }
    };
    var url = "/mobile/saveDealAlerts?hidUserEnteredMobile=" + u_mobile + "&stores_ids=" + b_id + "&categoryList=" + u_cat + "&d_EmailId=" + u_email + "&days=" + u_days + "&source=" + source + "&micrositeId=" + micrositeId + "&from=" + from + "&pageName=" + pageName + "&bizgainCampaignName=" + bizgainCampaignName + "&adChannelName=" + adChannelName + "&adCampaignName=" + adCampaignName + "&adGroupName=" + adGroupName + "&adIdentifier=" + adIdentifier;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}
function checkmobile(obj,ob) {
    var pattern = /^[0-9]{10,12}$/;
    var valid = true;
    var mobile = document.getElementById(ob + "_ph_no");
    var sms = document.getElementById(ob + "_sms");
    if(sms.checked == true) {
        if( ! pattern.test(mobile.value)) {
            alert(click2call_mobileNumber_valid);
            mobile.focus();
            valid = false;
        }
    }
    if(valid) {
        if(document.getElementById(obj + "_verify").style.display == "block") {
            document.getElementById(obj + "_verify").innerHTML = "";
            document.getElementById("d_button").style.display = "block";
        }
    }
}
function submitDownloadDealCoupon(obj,ob) {
    var dealId = document.getElementById(ob + "_dealId").value;
    var frmObj = document.getElementById(obj);
    var valid = true;
    if(ob == "hs" || ob == "dealWidget") {
        var pattern = /^[0-9]{10,12}$/;
        var mobile = document.getElementById(ob + "_ph_no");
        if( ! pattern.test(mobile.value)) {
            alert(mobile_valid);
            mobile.focus();
            valid = false;
        }
    }
    if(valid) {
        var businessId = document.getElementById(ob + "_businessId").value;
        var enteredNo = document.getElementById(ob + "_ph_no").value;
        var from = document.getElementById(ob + "_from").value;
        var hotsms_user_ph_no = document.getElementById(ob + "_user_ph_no").value;
        var MobileNo = checkingEnteredPhoneNoAvailabity(enteredNo);
        checkPhNoAvailability(ob);
        document.getElementById(ob + "_button").style.display = "none";
        if(obj == "hotsms_widget") {
            var content = "<div align='left' style='font-size: 11px; width: 200px' id='deal_auth_widget' class='ph_auth'></div>";
            document.getElementById(obj + "_verify").innerHTML = content;
            var ph_auth = document.getElementById("deal_auth_widget");
        } else {
            var content = "<div align='left' style='font-size: 11px; width: 200px' id='ph_auth'></div>";
            document.getElementById(obj + "_verify").innerHTML = content;
            var ph_auth = document.getElementById("ph_auth");
        }
        sleep(2000);
        document.getElementById(ob + "_hidUserEnteredMobile_HS").value = MobileNo;
        if(document.getElementById(ob + "_hidMobileStatus").value == "true") {
            if(obj == "hotsms" || obj == "hotsms_widget") {
                document.getElementById(obj + "_verify").style.display = "block";
                couponDownload(MobileNo,dealId,enteredNo,"",ph_auth,ob);
            }
        } else {
            if((enteredNo != "") && (hotsms_user_ph_no != enteredNo)) {
                document.getElementById(obj + "_verify").style.display = "block";
                submitPopUpActivation(obj,ob,enteredNo,ph_auth);
            } else {
                if(obj == "hotsms" || obj == "hotsms_widget") {
                    document.getElementById(obj + "_verify").style.display = "block";
                    couponDownload(MobileNo,dealId,enteredNo,"",ph_auth,ob);
                }
            }
        }
    }
    var userFbId = document.getElementById("userFbId").value;
    var businessName = document.getElementById("businessName").value;
    var fanPageUrl = document.getElementById("fanPageUrl").value;
    var dealTitle = document.getElementById("dealTitle").value;
    var from = document.getElementById("from").value;
    if(from == "Facebook") {
        authenticateFacebookUser("DealCoupon",userFbId,businessName,fanPageUrl,dealTitle);
    }
}
function couponDownload(m_number,dealId,u_number,from,ph_auth,ob) {
    var source = document.getElementById(ob + "_source").value;
    var businessId = document.getElementById(ob + "_businessId").value;
    if(document.getElementById("dealWidgetId")) {
        var widgetId = document.getElementById("dealWidgetId").value;
    }
    if(document.getElementById("bannerAdId")) {
        var adId = document.getElementById("bannerAdId").value;
    }
    if(document.getElementById(ob + "_destination")) {
        var destination = document.getElementById(ob + "_destination").value;
    }
    if(document.getElementById(ob + "_micrositeId")) {
        var micrositeId = document.getElementById(ob + "_micrositeId").value;
    }
    if(document.getElementById("pageName")) {
        var pageName = document.getElementById("pageName").value;
    }
    if(document.getElementById("bizgainCampaignName")) {
        var bizgainCampaignName = document.getElementById("bizgainCampaignName").value;
    }
    if(document.getElementById("adChannelName")) {
        var adChannelName = document.getElementById("adChannelName").value;
    }
    if(document.getElementById("adCampaignName")) {
        var adCampaignName = document.getElementById("adCampaignName").value;
    }
    if(document.getElementById("adGroupName")) {
        var adGroupName = document.getElementById("adGroupName").value;
    }
    if(document.getElementById("adIdentifier")) {
        var adIdentifier = document.getElementById("adIdentifier").value;
    }
    var xmlHttp;
    try {
        xmlHttp = new XMLHttpRequest();
    } catch(e) {
        try {
            xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch(e) {
            try {
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch(e) {
                alert(browser_support);
                return false;
            }
        }
    }
    xmlHttp.onreadystatechange = function() {
        ph_auth.innerHTML = "<img src='/images/processing.gif' style='margin:40px 0px 0px 40px;'>";
        if(xmlHttp.readyState == 4) {
            ph_auth.innerHTML = "";
            var response = xmlHttp.responseText;
            if(trim(response) == "Deal" && source == "Microsite") {
                ph_auth.innerHTML = "";
                document.downloadDealForm.action = "/showLandingPage/" + businessId + "?from=Deal";
                document.downloadDealForm.submit();
            } else {
                if(trim(response) == "BlackList") {
                    alert(black_mobile_message);
                    window.location.reload();
                } else {
                    if(from == "external") {
                        alert("The deal has been sent to your mobile as an SMS.");
                        window.location.reload();
                    } else {
                        if(trim(response) != "") {
                            alert("The deal has been sent to your mobile as an SMS.");
                            window.location.reload();
                        }
                    }
                }
            }
        }
    };
    var url = "/mobile/sendDealCoupon?hidUserEnteredMobile_HS=" + u_number + "&hid=" + dealId + "&source=" + source + "&from=" + destination + "&widgetId=" + widgetId + "&adId=" + adId + "&micrositeId=" + micrositeId + "&pageName=" + pageName + "&bizgainCampaignName=" + bizgainCampaignName + "&adChannelName=" + adChannelName + "&adCampaignName=" + adCampaignName + "&adGroupName=" + adGroupName + "&adIdentifier=" + adIdentifier;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}
function checkPhNoAvailability(ob) {
    var enteredPhoneno = "";
    enteredPhoneno = document.getElementById(ob + "_ph_no").value;
    var phoneno = checkingEnteredPhoneNoAvailabity(enteredPhoneno);
    var url = "/checkPhNoAvailability/" + enteredPhoneno;
    var xmlHttp = getXMLHTTP();
    if(xmlHttp) {
        xmlHttp.open("GET",url,false);
        xmlHttp.send(null);
        var response = xmlHttp.responseText;
        var responseArray = response.split("|");
        var responseValue = responseArray[1];
        if(responseValue == "false") {
            document.getElementById(ob + "_hidMobileStatus").value = "false";
        } else {
            document.getElementById(ob + "_userEmailId").value = responseArray[0];
            document.getElementById(ob + "_userId").value = responseArray[1];
            document.getElementById(ob + "_hidMobileStatus").value = "true";
            return true;
        }
    }
}
function checkMobileUserEmail(ob) {
    var enterdedPhoneno = "";
    enterdedPhoneno = document.getElementById(ob + "_ph_no").value;
    var phoneno = checkingEnteredPhoneNoAvailabity(enterdedPhoneno);
    if(phoneno != "") {
        var url = "/checkMobileUserEmail/" + phoneno;
        var xmlHttp = getXMLHTTP();
        if(xmlHttp) {
            xmlHttp.open("GET",url,false);
            xmlHttp.send(null);
            var response = xmlHttp.responseText;
            var responseArray = response.split("|");
            var responseArrayLen = responseArray.length;
            var responseValue = responseArray[1];
            if(responseValue != "true") {
                if(responseArrayLen == 3) {
                    document.getElementById(ob + "_EmailId").value = responseArray[1];
                    document.getElementById(ob + "_EmailId").disabled = true;
                    document.getElementById(ob + "_ph_no").value = responseArray[2];
                } else {
                    if(responseArray[1] != "") {
                        document.getElementById(ob + "_EmailId").value = responseArray[1];
                    }
                    if(responseArray[2] != "") {
                        document.getElementById(ob + "_ph_no").value = responseArray[2];
                    }
                    if(responseArray[3] == 1) {
                        document.getElementById(ob + "_sms").checked = true;
                        document.getElementById(ob + "_ph_no").value = responseArray[2];
                        document.getElementById("divDealAlertMobile").style.display = "block";
                    }
                    if(responseArray[4] == 1) {
                        document.getElementById(ob + "_ntemail").checked = true;
                        document.getElementById(ob + "_EmailId").value = responseArray[1];
                        document.getElementById("divDealAlertEmail").style.display = "block";
                    }
                    if(responseArray[5] == 1) {
                        document.getElementById("inboxCheck").disabled = false;
                        document.getElementById("inboxCheck").checked = true;
                    }
                    document.getElementById(ob + "_days").value = responseArray[6];
                }
                return true;
            }
        }
    } else {
        return false;
    }
}
var t;
var x = 100;
var y = 22;
var q = 5;
var f = 0;
var g = 0;
function changewidthandheight() {
    e = document.getElementById("divclicktocall");
    if(x > 200 && f == 0 && y > 125 && g == 0) {
        e.style.width = 200 + "px";
        e.style.height = 125 + "px";
        document.getElementById("divtxt").style.display = "block";
        closeDownLoadDealCouponPopup();
        closeDealAlertPopup();
        t = 0;
        x = 100;
        f = 0;
        y = 22;
        g = 0;
        return false;
    }
    if(x < 101 && f == 1 && y < 23 && g == 1) {
        f = 0;
        return false;
    }
    if(f) {
        q =  - 5;
    }
    if( ! f) {
        q = 5;
    }
    x = x + q;
    e.style.width = x + "px";
    if(g) {
        q =  - 5;
    }
    if( ! g) {
        q = 5;
    }
    y = y + q;
    e.style.height = y + "px";
    t = setTimeout("changewidthandheight();",0);
}
function closePopup(from) {
    if(document.getElementById("divtxt")) {
        document.getElementById("divtxt").style.display = "none";
        if(from == "c2c" || from == "c2c_widget") {
            window.location.reload();
        }
    }
    if(document.getElementById("divclicktocall")) {
        document.getElementById("divclicktocall").style.display = "none";
        document.getElementById("divclicktocall").style.width = 101 + "px";
        document.getElementById("divclicktocall").style.height = 22 + "px";
    }
    if(document.getElementById(from + "_button")) {
        document.getElementById(from + "_button").style.display = "block";
    }
    if(document.getElementById("click2call_verify")) {
        document.getElementById("click2call_verify").style.display = "none";
    }
    t = 0;
    x = 100;
    y = 22;
    return false;
}
function showClick2CallBlock(from) {
    t = 0;
    x = 100;
    y = 22;
    var xypos = getPosition(document.getElementById("divClick2CallPos"));
    var xyposarray = xypos.split("|");
    var xpos = xyposarray[0];
    var ypos = xyposarray[1];
    document.getElementById("divclicktocall").style.width = 100 + "px";
    document.getElementById("divclicktocall").style.height = 20 + "px";
    var height = "";
    var childnodeslength = document.getElementById("divClick2CallPos").childNodes.length;
    if(childnodeslength == 1) {
        for(var i=0;i<childnodeslength;i++) {
            height = document.getElementById("divClick2CallPos").childNodes[i].childNodes[0].height;
        }
        if(from != "click2CallWidget") {
            document.getElementById("divclicktocall").style.left = xpos - 20 + "px";
            document.getElementById("divclicktocall").style.top = (parseInt(ypos) + parseInt(height)) + "px";
        } else {
            height = 20;
            width = 5;
            document.getElementById("divclicktocall").style.left = (parseInt(xpos) + parseInt(width)) + "px";
            document.getElementById("divclicktocall").style.top = (parseInt(ypos) + 70) + "px";
        }
    } else {
        if(from != "click2CallWidget") {
            height = 37;
            document.getElementById("divclicktocall").style.left = xpos - 10 + "px";
            document.getElementById("divclicktocall").style.top = (parseInt(ypos) + parseInt(height) - 10) + "px";
        } else {
            height = 20;
            width = 35;
            document.getElementById("divclicktocall").style.left = (parseInt(xpos) - parseInt(width)) + "px";
            document.getElementById("divclicktocall").style.top = (parseInt(ypos) + 35) + "px";
            if(navigator.appName == "Microsoft Internet Explorer") {
                document.getElementById("divclicktocall").style.left = (parseInt(xpos) - 35) + "px";
                document.getElementById("divclicktocall").style.top = (parseInt(ypos) - 260) + "px";
            }
        }
    }
    document.getElementById("divclicktocall").style.display = "block";
    document.getElementById("divtxt").style.display = "none";
    changewidthandheight();
}
function showClick2CallInSearchBusiness(vendorId,merchantNo,type) {
    t = 0;
    x = 100;
    y = 22;
    var xypos = getPosition(document.getElementById("searchBusinessClick2CallPos_" + vendorId + "_" + type));
    if(document.getElementById("c2c_merchant")) {
        document.getElementById("c2c_merchant").value = merchantNo;
    }
    if(document.getElementById("c2c_vendorId")) {
        document.getElementById("c2c_vendorId").value = vendorId;
    }
    var xyposarray = xypos.split("|");
    var xpos = xyposarray[0];
    var ypos = xyposarray[1];
    document.getElementById("divclicktocall").style.width = 100 + "px";
    document.getElementById("divclicktocall").style.height = 20 + "px";
    document.getElementById("divclicktocall").style.left = (parseInt(xpos) + 76) + "px";
    document.getElementById("divclicktocall").style.top = (parseInt(ypos) + 57) + "px";
    document.getElementById("divclicktocall").style.display = "block";
    document.getElementById("divtxt").style.display = "none";
    if(navigator.appName == "Microsoft Internet Explorer") {
        document.getElementById("divclicktocall").style.left = (parseInt(xpos) - 30) + "px";
        document.getElementById("divclicktocall").style.top = (parseInt(ypos) - 260) + "px";
    }
    changewidthandheight();
}
var t;
var x = 100;
var y = 22;
var q = 5;
var f = 0;
var g = 0;
function downloadDealCouponchangewidthandheight() {
    e = document.getElementById("divDownloadDealCoupon");
    if(x > 200 && f == 0 && y > 125 && g == 0) {
        e.style.width = 200 + "px";
        e.style.height = 125 + "px";
        document.getElementById("hs_divDownloadDealCoupontxt").style.display = "block";
        closePopup();
        closeDealAlertPopup();
        t = 0;
        x = 100;
        f = 0;
        y = 22;
        g = 0;
        return false;
    }
    if(x < 101 && f == 1 && y < 23 && g == 1) {
        f = 0;
        return false;
    }
    if(f) {
        q =  - 5;
    }
    if( ! f) {
        q = 5;
    }
    x = x + q;
    e.style.width = x + "px";
    if(g) {
        q =  - 5;
    }
    if( ! g) {
        q = 5;
    }
    y = y + q;
    e.style.height = y + "px";
    t = setTimeout("downloadDealCouponchangewidthandheight();",0);
}
function closeDownLoadDealCouponPopup() {
    if(document.getElementById("hs_divDownloadDealCoupontxt")) {
        document.getElementById("hs_divDownloadDealCoupontxt").style.display = "none";
    }
    if(document.getElementById("divDownloadDealCoupon")) {
        document.getElementById("divDownloadDealCoupon").style.display = "none";
    }
    if(document.getElementById("divDownloadDealCoupon")) {
        document.getElementById("divDownloadDealCoupon").style.width = 101 + "px";
        document.getElementById("divDownloadDealCoupon").style.height = 22 + "px";
    }
    if(document.getElementById("hs_button")) {
        document.getElementById("hs_button").style.display = "block";
    }
    if(document.getElementById("hotsms_verify")) {
        document.getElementById("hotsms_verify").style.display = "none";
    }
    t = 0;
    x = 100;
    y = 22;
    return false;
}
function getPosition(who) {
    var T = 0
    ,L=0;
    while(who) {
        L += who.offsetLeft;
        T += who.offsetTop;
        who = who.offsetParent;
    }
    var position = L + "|" + T;
    return position;
}
function showDownLoadDealCoupon(from) {
    t = 0;
    x = 100;
    y = 22;
    var xypos = getPosition(document.getElementById("divDownloadDealCouponPos"));
    var xyposarray = xypos.split("|");
    var xpos = xyposarray[0];
    var ypos = xyposarray[1];
    document.getElementById("divDownloadDealCoupon").style.width = 100 + "px";
    document.getElementById("divDownloadDealCoupon").style.height = 20 + "px";
    var height = "";
    var childnodeslength = document.getElementById("divDownloadDealCouponPos").childNodes.length;
    if(childnodeslength == 1) {
        for(var i=0;i<childnodeslength;i++) {
            height = document.getElementById("divDownloadDealCouponPos").childNodes[i].childNodes[0].height;
        }
        document.getElementById("divDownloadDealCoupon").style.left = xpos - 20 + "px";
        document.getElementById("divDownloadDealCoupon").style.top = (parseInt(ypos) + parseInt(height)) + "px";
    } else {
        if(from == undefined) {
            height = 29;
            document.getElementById("divDownloadDealCoupon").style.left = xpos - 20 + "px";
            document.getElementById("divDownloadDealCoupon").style.top = (parseInt(ypos) + parseInt(height)) + "px";
            if(navigator.appName == "Microsoft Internet Explorer") {
                document.getElementById("divDownloadDealCoupon").style.left = (parseInt(xpos) - 35) + "px";
                document.getElementById("divDownloadDealCoupon").style.top = (parseInt(ypos) - 260) + "px";
            }
        } else {
            if(from == "dealWidget") {
                height = 20;
                width = 20;
                document.getElementById("divDownloadDealCoupon").style.left = (parseInt(xpos) + parseInt(width)) + "px";
                document.getElementById("divDownloadDealCoupon").style.top = (parseInt(ypos) + parseInt(height) + 60) + "px";
            }
        }
    }
    document.getElementById("divDownloadDealCoupon").style.display = "block";
    document.getElementById("hs_divDownloadDealCoupontxt").style.display = "none";
    downloadDealCouponchangewidthandheight();
}
function showDownLoadDealCouponInSearchBusiness(vendorId,dealId,type) {
    t = 0;
    x = 0;
    y = 0;
    var xypos = getPosition(document.getElementById("searchBusinessDownloadDealCouponPos_" + vendorId + "_" + type));
    var xyposarray = xypos.split("|");
    var xpos = xyposarray[0];
    var ypos = xyposarray[1];
    document.getElementById("hs_hid").value = dealId;
    document.getElementById("divDownloadDealCoupon").style.width = 100 + "px";
    document.getElementById("divDownloadDealCoupon").style.height = 20 + "px";
    document.getElementById("divDownloadDealCoupon").style.left = (parseInt(xpos) + 76) + "px";
    document.getElementById("divDownloadDealCoupon").style.top = (parseInt(ypos) + 55) + "px";
    document.getElementById("divDownloadDealCoupon").style.display = "block";
    document.getElementById("hs_divDownloadDealCoupontxt").style.display = "none";
    if(navigator.appName == "Microsoft Internet Explorer") {
        document.getElementById("divDownloadDealCoupon").style.left = (parseInt(xpos) - 30) + "px";
        document.getElementById("divDownloadDealCoupon").style.top = (parseInt(ypos) - 260) + "px";
    }
    downloadDealCouponchangewidthandheight();
}
var t;
var x = 100;
var y = 22;
var q = 5;
var f = 0;
var g = 0;
function dealAlertchangewidthandheight() {
    e = document.getElementById("divDealAlert");
    if(x > 200 && f == 0 && y > 180 && g == 0) {
        e.style.width = 200 + "px";
        e.style.height = 180 + "px";
        document.getElementById("divDealAlerttxt").style.display = "block";
        closePopup();
        closeDownLoadDealCouponPopup();
        t = 0;
        x = 100;
        f = 0;
        y = 22;
        g = 0;
        return false;
    }
    if(x < 101 && f == 1 && y < 23 && g == 1) {
        f = 0;
        return false;
    }
    if(f) {
        q =  - 5;
    }
    if( ! f) {
        q = 5;
    }
    x = x + q;
    e.style.width = x + "px";
    if(g) {
        q =  - 5;
    }
    if( ! g) {
        q = 5;
    }
    y = y + q;
    e.style.height = y + "px";
    t = setTimeout("dealAlertchangewidthandheight();",0);
}
function closeDealAlertPopup() {
    if( ! document.getElementById("divDealAlerttxt")) {
        if(parent.document.getElementById("divDealAlerttxt")) {
            parent.document.getElementById("divDealAlerttxt").style.display = "none";
        }
    }
    if(document.getElementById("divDealAlerttxt")) {
        document.getElementById("divDealAlerttxt").style.display = "none";
    }
    if(document.getElementById("divDealAlert")) {
        document.getElementById("divDealAlert").style.display = "none";
        document.getElementById("divDealAlert").style.width = 101 + "px";
        document.getElementById("divDealAlert").style.height = 22 + "px";
    }
    if(parent.dealAlertIframe) {
        parent.dealAlertIframe.location.reload();
    } else {
        if(document.getElementById("divDealAlerttxt")) {
            if(document.getElementById("divDealAlerttxt").style.display == "block") {
                window.location.reload();
            }
        }
    }
    t = 0;
    x = 100;
    y = 22;
    return false;
}
function showDealAlertBlock(from) {
    t = 0;
    x = 100;
    y = 22;
    var xypos = getPosition(document.getElementById("divDealAlertPos"));
    var xyposarray = xypos.split("|");
    var xpos = xyposarray[0];
    var ypos = xyposarray[1];
    document.getElementById("divDealAlert").style.width = 100 + "px";
    document.getElementById("divDealAlert").style.height = 20 + "px";
    var height = "";
    var childnodeslength = document.getElementById("divDealAlertPos").childNodes.length;
    if(childnodeslength == 1) {
        for(var i=0;i<childnodeslength;i++) {
            height = document.getElementById("divDealAlertPos").childNodes[i].childNodes[0].height;
        }
        document.getElementById("divDealAlert").style.left = xpos - 20 + "px";
        document.getElementById("divDealAlert").style.top = (parseInt(ypos) + parseInt(height)) + "px";
    } else {
        if(from != "dealAlertWidget") {
            height = 30;
            document.getElementById("divDealAlert").style.left = xpos - 5 + "px";
            document.getElementById("divDealAlert").style.top = (parseInt(ypos) + parseInt(height)) + "px";
			if(navigator.appName == "Microsoft Internet Explorer") {
                document.getElementById("divDealAlert").style.left = (parseInt(xpos) - 10) + "px";
                document.getElementById("divDealAlert").style.top = (parseInt(ypos) - 260) + "px";
            }
        } else {
            height = 5;
            width = 20;
            document.getElementById("divDealAlert").style.left = (parseInt(xpos) + parseInt(width)) + "px";
            document.getElementById("divDealAlert").style.top = (parseInt(ypos) + parseInt(height) + 60) + "px";
        }
    }
    document.getElementById("divDealAlert").style.display = "block";
    document.getElementById("divDealAlerttxt").style.display = "none";
    dealAlertchangewidthandheight();
}
function getDealAlertDetailsFromMobileUser(ob) {
    if(document.getElementById("sms").checked == true) {
        document.getElementById("divDealAlertMobile").style.display = "block";
        if(document.getElementById(ob + "_ph_no").value != "") {
            checkingUserDetailsAvailability("MobileNo",ob);
            checkMobileUserEmail(ob);
        }
    } else {
        document.getElementById("divDealAlertMobile").style.display = "none";
        return false;
    }
}
function getDealAlertDetailsFromEmailUser(ob) {
    if(document.getElementById(ob + "_ntemail").checked == true) {
        document.getElementById("divDealAlertEmail").style.display = "block";
        if(document.getElementById(ob + "_EmailId").value != "") {
            checkingUserDetailsAvailability("Email",ob);
            checkEmailUserMobile(ob);
        }
    } else {
        document.getElementById("divDealAlertEmail").style.display = "none";
        return false;
    }
}
function checkingUserDetailsAvailability(from,ob) {
    var email = document.getElementById(ob + "_EmailId").value;
    var phoneno = document.getElementById(ob + "_ph_no").value;
    if(from == "MobileNo") {
        var source = checkingEnteredPhoneNoAvailabity(phoneno);
        document.getElementById(ob + "_hidUserEnteredMobile").value = source;
    } else {
        var source = email;
    }
    var url = "/checkingUserDetailsAvailability/" + source + "/" + from;
    var xmlHttp = getXMLHTTP();
    if(xmlHttp) {
        xmlHttp.open("GET",url,false);
        xmlHttp.send(null);
        var response = xmlHttp.responseText;
        var responseArray = response.split("|");
        var responseValue = responseArray[1];
        if(responseValue != "") {
            if(responseValue == 42) {
                return true;
            } else {
                return false;
            }
        }
    }
}
function checkEmailUserMobile(ob) {
    var emailId = "";
    emailId = document.getElementById(ob + "_EmailId").value;
    if(emailId != "") {
        var url = "/checkEmailUserMobile/" + emailId;
        var xmlHttp = getXMLHTTP();
        if(xmlHttp) {
            xmlHttp.open("GET",url,false);
            xmlHttp.send(null);
            var response = xmlHttp.responseText;
            var responseArray = response.split("|");
            var responseArrayLen = responseArray.length;
            var responseValue = responseArray[1];
            if(responseValue != "true") {
                if(responseArrayLen == 3) {
                    document.getElementById(ob + "_EmailId").value = responseArray[1];
                    document.getElementById(ob + "_EmailId").disabled = true;
                    document.getElementById(ob + "_ph_no").value = responseArray[2];
                } else {
                    if(responseArray[1] != "") {
                        document.getElementById(ob + "_EmailId").value = responseArray[1];
                    }
                    if(responseArray[2] != "") {
                        document.getElementById("d_ph_no").value = responseArray[2];
                    }
                    if(responseArray[3] == 1) {
                        document.getElementById(ob + "_sms").checked = true;
                        document.getElementById(ob + "_ph_no").value = responseArray[2];
                        document.getElementById("divDealAlertMobile").style.display = "block";
                    }
                    if(responseArray[4] == 1) {
                        document.getElementById(ob + "_ntemail").checked = true;
                        document.getElementById(ob + "_EmailId").value = responseArray[1];
                        document.getElementById("divDealAlertEmail").style.display = "block";
                    }
                    if(responseArray[5] == 1) {
                        document.getElementById("inboxCheck").disabled = false;
                        document.getElementById("inboxCheck").checked = true;
                    }
                    document.getElementById(ob + "_days").value = responseArray[6];
                }
                return true;
            }
        }
    } else {
        return false;
    }
}
function checkingEnteredPhoneNoAvailabity(enteredPhoneno) {
    var phNoLen = enteredPhoneno.length;
    var phoneNo = "";
    if(phNoLen == 9) {
        phoneNo = enteredPhoneno;
    } else {
        if(phNoLen == 10) {
            phoneNo = enteredPhoneno;
        } else {
            if(phNoLen == 11) {
                phoneNo = enteredPhoneno.substr(1,phNoLen);
            } else {
                if(phNoLen == 12) {
                    phoneNo = enteredPhoneno.substr(2,phNoLen);
                } else {
                    if(phNoLen == 13) {
                        phoneNo = enteredPhoneno.substr(3,phNoLen);
                    }
                }
            }
        }
    }
    return phoneNo;
}
function showWidgetHide(elementid) {
    if( ! document.getElementById(elementid)) {
        parent.document.getElementById(elementid).style.display = "none";
    }
    if(document.getElementById(elementid)) {
        if(document.getElementById(elementid).style.display == "none") {
            document.getElementById(elementid).style.display = "block";
        } else {
            document.getElementById(elementid).style.display = "none";
        }
    }
    if(elementid != "signup-newsletter" && parent.document.getElementById("signup-newsletter")) {
        parent.document.getElementById("signup-newsletter").style.display = "none";
    }
    if(elementid != "contactus" && parent.document.getElementById("contactus")) {
        parent.document.getElementById("contactus").style.display = "none";
    }
    if(elementid != "divDealAlerttxt" && parent.document.getElementById("divDealAlerttxt")) {
        parent.document.getElementById("divDealAlerttxt").style.display = "none";
    }
}
function bannerAdImageAlignment(adSize,adImageWidth,adImageHeight) {
    var oElement = document.getElementById("imageDiv");
    if(window.getComputedStyle) {
        originalWidth = window.getComputedStyle(oElement,null).width;
        originalHeight = window.getComputedStyle(oElement,null).height;
        var divHeight = originalHeight.split("px");
    } else {
        if(oElement.currentStyle) {
            originalWidth = oElement.currentStyle.width;
            originalHeight = oElement.currentStyle.height;
            var divHeight = originalHeight.split("px");
        }
    }
    if(parseInt(adImageWidth) >= parseInt(originalWidth)) {
        document.getElementById("adImage").style.width = originalWidth;
        var originalWidthSplit = originalWidth.split("px");
        var compressionWidth = (originalWidthSplit[0]/adImageWidth) * 100;
        var compressionHeight = (adImageHeight/100) * compressionWidth;
    }
    if(compressionHeight == "" || compressionHeight == "undefined" || compressionHeight == "null") {
        compressionHeight = "0";
    }
    var originalHeightSplit = originalHeight.split("px");
    if(parseInt(compressionHeight) && (parseInt(compressionHeight) >= parseInt(originalHeightSplit[0]))) {
        document.getElementById("adImage").style.height = originalHeight;
        var compressionHeight = (originalHeightSplit[0]/adImageHeight) * 100;
        var reCompressionWidth = (adImageWidth/100) * compressionHeight;
        document.getElementById("adImage").style.width = parseInt(reCompressionWidth) + "px";
    } else {
        if(parseInt(adImageHeight) >= parseInt(divHeight[0])) {
            document.getElementById("adImage").style.height = divHeight[0];
        }
    }
}

function showNewsLetterBlock()
{
	t = 0;
    x = 100;
    y = 22;
    var xypos = getPosition(document.getElementById("divNewsLetterPos"));
    var xyposarray = xypos.split("|");
    var xpos = xyposarray[0];
    var ypos = xyposarray[1];
    document.getElementById("divNewsLetter").style.width = 100 + "px";
    document.getElementById("divNewsLetter").style.height = 20 + "px";
    var height = "";
    var childnodeslength = document.getElementById("divNewsLetterPos").childNodes.length;
    if(childnodeslength == 1) {
        for(var i=0;i<childnodeslength;i++) {
            height = document.getElementById("divNewsLetterPos").childNodes[i].childNodes[0].height;
        }
        document.getElementById("divNewsLetter").style.left = xpos - 20 + "px";
        document.getElementById("divNewsLetter").style.top = (parseInt(ypos) + parseInt(height)) + "px";
    } else {
            height = 5;
            width = 20;
            document.getElementById("divNewsLetter").style.left = (parseInt(xpos) + parseInt(width)) + "px";
            document.getElementById("divNewsLetter").style.top = (parseInt(ypos) + parseInt(height) + 80) + "px";
			if(navigator.appName == "Microsoft Internet Explorer") {
                document.getElementById("divNewsLetter").style.left = (parseInt(xpos) - 35) + "px";
                document.getElementById("divNewsLetter").style.top = (parseInt(ypos) - 260) + "px";
            }
    }
    document.getElementById("divNewsLetter").style.display = "block";
    document.getElementById("divNewsLetterTxt").style.display = "none";
    newsLetterchangewidthandheight();
}

function newsLetterchangewidthandheight() {
    e = document.getElementById("divNewsLetter");
    if(x > 200 && f == 0 && y > 180 && g == 0) {
        e.style.width = 207 + "px";
        e.style.height = 180 + "px";
        document.getElementById("divNewsLetterTxt").style.display = "block";
        closePopup();
        closeDownLoadDealCouponPopup();
        t = 0;
        x = 100;
        f = 0;
        y = 22;
        g = 0;
        return false;
    }
    if(x < 101 && f == 1 && y < 23 && g == 1) {
        f = 0;
        return false;
    }
    if(f) {
        q =  - 5;
    }
    if( ! f) {
        q = 5;
    }
    x = x + q;
    e.style.width = x + "px";
    if(g) {
        q =  - 5;
    }
    if( ! g) {
        q = 5;
    }
    y = y + q;
    e.style.height = y + "px";
    t = setTimeout("newsLetterchangewidthandheight();",0);
}

function closeNewsLetter() {
    if( ! document.getElementById("divNewsLetterTxt")) {
        if(parent.document.getElementById("divNewsLetterTxt")) {
            parent.document.getElementById("divNewsLetterTxt").style.display = "none";
        }
    }
    if(document.getElementById("divNewsLetterTxt")) {
        document.getElementById("divNewsLetterTxt").style.display = "none";
    }
    if(document.getElementById("divNewsLetter")) {
        document.getElementById("divNewsLetter").style.display = "none";
        document.getElementById("divNewsLetter").style.width = 101 + "px";
        document.getElementById("divNewsLetter").style.height = 22 + "px";
    }
    /*if(parent.dealAlertIframe) {
        parent.dealAlertIframe.location.reload();
    } else {
        if(document.getElementById("divNewsLetterTxt")) {
            if(document.getElementById("divNewsLetterTxt").style.display == "block") {
                window.location.reload();
            }
        }
    }*/
    t = 0;
    x = 100;
    y = 22;
    return false;
}

