﻿var urlAddress = "http://www.meethalfway.com";

function addToFavorites()
{
    if (window.external) {
        window.external.AddFavorite(urlAddress, 'Meet Halfway - meethalfway.com') } 
    else { alert("Press (CTRL-D) to bookmark this page!"); } 
}

function popup(url, name, width, height, scrollable) {
    // shows a pop up window
    var left = (screen.width) ? (screen.width-width)/2 : 0;
    var top = (screen.height) ? (screen.height-height)/3 : 0;
    
    var scrollValue = 0;
    // create the popup settings now
    if (scrollable) scrollValue = 1;
    
    var settings = 'height='+ height + ',width=' + width + ',top= ' + top + ',left=' + left + ',scrollbars=1,status=0,location=0,menubar=1,resizable=1';
    // open the new window
    win = window.open(url, name, settings);
}


function resizeWinTo( idOfDiv ) {
    var oH = getRef(idOfDiv); if( !oH ) { return false; }
    var oW = oH.clip ? oH.clip.width : oH.offsetWidth;
    var oH = oH.clip ? oH.clip.height : oH.offsetHeight; if( !oH ) { return false; }
    var x = window; x.resizeTo( oW + 200, oH + 200 );
    var myW = 0, myH = 0, d = x.document.documentElement, b = x.document.body;
    if( x.innerWidth ) { myW = x.innerWidth; myH = x.innerHeight; }
    else if( d && d.clientWidth ) { myW = d.clientWidth; myH = d.clientHeight; }
    else if( b && b.clientWidth ) { myW = b.clientWidth; myH = b.clientHeight; }
    if( window.opera && !document.childNodes ) { myW += 16; }
    x.resizeTo( oW + ( ( oW + 200 ) - myW ), oH + ( (oH + 200 ) - myH ) );
}

function CancelBubbleEvents()
{
    //event.cancelBubble = true;
}

function ManageFormDropdownsVisibility(visible)
{
    if (BrowserDetect.browser == "Explorer" && parseInt(BrowserDetect.version) < 7)
    {
        for (var i = 0; i < document.forms[0].elements.length; i++)
        {
             var formElem = document.forms[0].elements[i];
             if (formElem.type == 'select-one')
             {
                if (!visible) formElem.style.display = 'none';
                else formElem.style.display = 'block';
             }
        }
    }
}