﻿
// For URL Rewriting set //

document.forms[0].action = window.location;
function setOption(arg) {
    
    document.forms[0].postoption.value = arg;
}

// For Printing //

function popup(url) {
    var width = 640;
    var height = 450;
    var left = (screen.width - width) / 2;
    var top = (screen.height - height) / 2;
    var params = 'width=' + width + ', height=' + height;
    params += ', top=' + top + ', left=' + left;
    params += ', directories=no';
    params += ', location=no';
    params += ', menubar=no';
    params += ', resizable=no';
    params += ', scrollbars=yes';
    params += ', status=no';
    params += ', toolbar=no';
    newwin = window.open(url, 'windowname5', params);
    if (window.focus) { newwin.focus() }
    return false;
}

function PrintControl(ctrl) {
    var PrintValue = document.getElementById(ctrl).innerHTML;
    var WinPrint = window.open('', '', 'left=' + screen.width + ',top=' + screen.height + ',width=1,height=1,toolbar=0,scrollbars=0,status=0');
    PrintValue = "<table border='1' bordercolor='black' cellpadding='0' cellspacing='0'><tr><td>" + PrintValue + "</td></tr></table>";
    WinPrint.document.write(PrintValue);
    WinPrint.document.close();
    WinPrint.focus();

    WinPrint.print();
    WinPrint.close();
    return false;
}

function CreateBookmarkLink(url, title) 
{
   
    if (window.sidebar) {
        // Mozilla Firefox Bookmark
        window.sidebar.addPanel(title, url, "");
    }

    else if (window.external) {
    // IE Favorite
    
        window.external.AddFavorite(url, title);
    }

    else if (window.opera && window.print) // opera
    { 
        var element = document.createElement("a");
        element.setAttribute("href", url);
        element.setAttribute("title", title);
        element.setAttribute("rel", "sidebar");
        element.click();
    }
}


function doRedirect(val) {
    var sTargetURL = "";
    //alert("val" + val);
    setTimeout(window.location.href = val, 10000);
}

function SetHiddValue() {
    //alert(document.getElementById("himg").src);
    document.getElementById("himg").src = document.getElementById("himg").src + "/categorydeals_new.aspx?SetSession=1";
}

//function doDefaultVal(val) {
//    if (document.getElementById("ctl00_ContentPlaceHolder1_shoopers1_txtemailsignin").value == "") {
//        document.getElementById("ctl00_ContentPlaceHolder1_shoopers1_txtemailsignin").value = val;
//    }
//}
//function doDefaultValnew(val) {
//    if (document.getElementById("ctl00_txtWhat").value == "") {
//        document.getElementById("ctl00_txtWhat").value = val;
//    }
//    if (document.getElementById("ctl00_txtWhere").value == "") {
//        document.getElementById("ctl00_txtWhere").value = val;
//    }
//}



function ShowHideMsg(ctrl, msg) {
        var strVal = msg;
        var strVal1 = StringReplace(strVal);
        var strVal2 = StringReplace(ctrl.value);
        if (trim(strVal2) == "")
            ctrl.value = strVal;
        else {
            if (strVal1 == strVal2)
                ctrl.value = "";
        }

    }
    function trim(str) {
        result = str.replace(/(^ +| +$)/, "");
        return result;
    }
    function StringReplace(strVal) {
        return ((strVal.replace(" ", "")).replace("&", "")).replace("'", "");
    }
