﻿
// Hack to fix bug in MS AJAX that causes page load events to be missed in WebKit browsers
Sys.Browser.WebKit = {}; 
if (navigator.userAgent.indexOf('WebKit/') > -1) 
{
	Sys.Browser.agent = Sys.Browser.WebKit;
	Sys.Browser.version = parseFloat(navigator.userAgent.match(/WebKit\/(\d+(\.\d+)?)/)[1]);
	Sys.Browser.name = 'WebKit';
}

jQuery(document).ready(function(){
    jQuery.noConflict();
    jQuery("div.instructions").each(function(){ CheckInstructions("#" + this.id); });
    //jQuery("img[@src$=png], div.png, #logo, #searchbar div").pngfix();
});

Sys.Application.add_load(function()
{
    jQuery(".infotip").each(function()
    {
        jQuery(this).qtip({
            content: {
                text: jQuery(this).children("dfn").html(),
                title:  jQuery(this).children("label").text().replace(":","")
            },
            style: {width: {max:400}, name: 'keen', tip : 'leftTop' },
            show: 'mouseover',
			hide: 'mouseout',
			position: {
			    adjust: { y:-12, x:4 }
			}
        });
    });
});  
  
function ToggleInstructions(name)
{
    if(name)
    {
        jQuery(name).hide("slow");
        jQuery.cookie(name, "none");
    }
}

function CheckInstructions(name)
{
    if(name)
    {
        if(jQuery.cookie(name))
        {
            jQuery(name).css("display", "none");
        }
        else jQuery(name).css("display", "block");
    }
}

jQuery.fn.qtip.styles.keen = { 
    tip: { corner: 'leftMiddle' },
    name: 'cream',
    width: { max: 250, min: 100 },
    padding: 20,
    background: '#fff',
    color: 'black',
    textAlign: 'left',
    border: {
      width: 4,
      radius: 0,
      color: '#ccc'
    },
    title: {
        background: '#e83104',
        color: '#ffffff'
    }
}