function setContentDimensions (c,minW,minH)
{
    if ($(window).height()<minH)
    {
        c.height(minH);
    }
    else
    {
        c.height($(window).height());
    }
    
    if ($(window).width()<minW)
    {
     c.width(minW);
    }
    else
    {
        c.width($(window).width());
    }
}

/*
 * Calculate the content dimensions with constraints on size
 */
function calcContstraints(minW,minH) {
    var size = {}; 
    var w = $(window).width(); 
    var h = $(window).height();
    
   	if (w < minW)
   	    size.width = minW;
	else
	    size.width = w;

   	if (h < minH)
   	    size.height = minH;
	else
	    size.height = h;
	    
	return size;
}


function OpenPopup(url, width, height) {
    window.open(url, 'newWindow', 'resizable=1,scrollbars=no,width=' + width + ',height=' + height);
}

function SendToFriend(customQueryString) {
    var currentUrl = window.location.href;

    if (customQueryString.length > 0) {
        if (currentUrl.indexOf('?') != -1) {
            currentUrl += "&" + customQueryString;
        }
        else {
            currentUrl += "?" + customQueryString;
        }
    }

    OpenPopup("/SendToFriend.aspx?url=" + escape(currentUrl), '700', '520');
}

function BookmarkPage(customQueryString, pageName) {
    var currentUrl = window.location.href;

    if (customQueryString.length > 0) {
        if (currentUrl.indexOf('?') != -1) {
            currentUrl += "&" + customQueryString;
        }
        else {
            currentUrl += "?" + customQueryString;
        }
    }

    if ((navigator.appName.indexOf("Microsoft", 0) >= 0) && (parseInt(navigator.appVersion) >= 4) && navigator.platform == 'Win32') {
        window.external.AddFavorite(currentUrl, pageName);
    }

    else {
        alert("Please click Ctrl+D or 'Apple'+D (Safari) to add this page to your bookmarks.");
    }

}

function setFacebookDimensions (z,fbL,fbT)
{    
    if ($(window).height()<= 660)
    {
        z.css('top',640);
    }
    else
    {
        z.css({top: (parseInt($(window).height()) / 2) + 310});
    }
    
    if ($(window).width()<=805)
    {
     z.css('left', 0);
    }
    else
    {
        z.css({left:(parseInt($(window).width())-800)/2});
    }
}