/*
 * Misc Javascript
 * 
 * created by: Gary Ackerman - 0/15/2010
 *
 */




function getQuotes() {
    document.getElementById("ctl00_phContent_cb1").click();
}
            
            
var child_window = window;
var parent_window = window;
function applyClick(url) {
    child_window = window.open("https://www.healthedeals.com/apply.aspx?url="+ url, "applyOnline", "width=1024,height=600,directories=0,location=0,menu=0,scrollbars=no,status=0,toolbar=0,resizable=0'");
    parent_window.onclick = blurify;
    parent_window.onfocus = blurify;
    return false;
}
function blurify() {
    if (child_window) {
        if (parent_window)
            parent.window.blur();
            child_window.focus();
    }
}
            
/********** Beg:Print Preview *************/
function printPreview()
    {
    var OLECMDID = 7;
    /* OLECMDID values:
    * 6 – print
    * 7 – print preview
    * 1 – open window
    * 4 – Save As
    * 10 - properties
    */
    var PROMPT = 1; // 2 DONTPROMPTUSER

    try {
        var oWebBrowser = document.getElementById("WebBrowser1");

        if (oWebBrowser == null) {
            var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
            document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
            //document.body.innerHTML += WebBrowser;
            oWebBrowser = document.getElementById("WebBrowser1");
            //WebBrowser1.ExecWB(OLECMDID, PROMPT);
            //WebBrowser1.outerHTML = "";
        }
        oWebBrowser.ExecWB(OLECMDID, PROMPT);

        }
    catch (e) {
        //alert("Printing Failed! " + e.message);
        window.print();
        }
    }
/********** End:Print Preview *************/

function GetDate(ctrlName)    
{   
/****************************************************      
Use Javascript method (window.open) to PopUp a new window    
which contain a Calendar Control. In the meantime, we'll    
pass the Parent Form Name and Request Control Name in the QueryString!      
*****************************************************/        
ChildWindow = window.open('popupCalendar.aspx?fn=' + document.forms[0].name + '&cn=' + ctrlName, "PopUpCalendar", "width=270,height=300,top=200,left=200,toolbars=no,scrollbars=no,status=no,resizable=no");    
}   
           
function CheckWindow()   
{      
ChildWindow.close();   
}
           
function btnDisable(btn)
{
    var db = document.getElementById(btn);
    //db.className = "testing";
    //db.click();         
    //db.className = "disabled";
    //if (btn == "ctl00$phContent$imgPaymentContinue"){db.disabled = true;}
}

function addFav(url, title) {
    if (window.sidebar) { // Mozilla Firefox Bookmark
        window.sidebar.addPanel(title, url, "");
    }
    else if (window.external) { // IE Favorites
        window.external.AddFavorite(url, title);
    }
    else { //all others
        alert('To bookmark this link, right-click (or cmd+click) this link and choose ‘add to bookmarks’');
    }
}

/********** Beg:popit *************/
var mypop;
function popit(theUrl) 
{
	mypop = window.open(theUrl, 'popit', 'width=700,height=500,directories=no,location=no,menu=no,scrollbars=yes,status=no,toolbar=no,resizable=yes');
	mypop.focus();
	return false;
}
function na_preload_img()
{ 
    var img_list = na_preload_img.arguments;
    if (document.preloadlist == null) document.preloadlist = new Array();
                
    var top = document.preloadlist.length;
    for (var i=0; i < img_list.length-1; i++) 
    {
        document.preloadlist[top+i] = new Image;
        document.preloadlist[top+i].src = img_list[i+1];
    } 
}
/********** End:popit *************/

function na_change_img_src(name, nsdoc, rpath, preload)
{ 
    var img = eval((navigator.appName.indexOf('Netscape', 0) != -1) ? nsdoc+'.'+name : 'document.all.'+name);
    if (name == '') return;
    if (img) 
    {
        img.altsrc = img.src;
        img.src    = rpath;
    } 
}

function na_restore_img_src(name, nsdoc)
{
    var img = eval((navigator.appName.indexOf('Netscape', 0) != -1) ? nsdoc+'.'+name : 'document.all.'+name);
    if (name == '') return;
    if (img && img.altsrc) 
    {
        img.src    = img.altsrc;
        img.altsrc = null;
    } 
}

