/*
 * Tooltip script 
 * powered by jQuery (http://www.jquery.com)
 * 
 * written by Alen Grakalic (http://cssglobe.com)
 * 
 * for more info visit http://cssglobe.com/post/1695/easiest-tooltip-and-image-preview-using-jquery
 *
 */

//Error Handling
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(onEndRequest);
function onEndRequest(sender, args) {
    var error = args.get_error();
    if (error != null) {
        // Set the error handled flag to avoid a runtime error  
        // reaching the user.  
        args.set_errorHandled(true);

        // Remove the error name from the message
        var msg = error.description;
       // location.reload(true);
       
    }
} 
 
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
function EndRequestHandler(sender, args) {
    tooltip();
    disableSelection(document.body);
}

function disableSelection(target) {
    if (typeof target.onselectstart != "undefined") //IE route
        target.onselectstart = function() { return false }
    else if (typeof target.style.MozUserSelect != "undefined") //Firefox route
        target.style.MozUserSelect = "none"
    else //All other route (ie: Opera)
        target.onmousedown = function() { return false }
    target.style.cursor = "default"
}

this.tooltip = function(){	
	/* CONFIG */		
		xOffset = 10;
		yOffset = 20;		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result		
	/* END CONFIG */		
	$("a.tooltip").hover(function(e){											  
		this.t = this.title;
		this.title = "";									  
		$("body").append("<div id='tooltip'>"+ this.t +"</div>");
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");		
    },
	function(){
		this.title = this.t;		
		$("#tooltip").remove();
    });	
	$("a.tooltip").mousemove(function(e){
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};

$(document).ready(function() {
    $('li.headlink').hover(
			function() { $('ul', this).css('display', 'block'); },
			function() { $('ul', this).css('display', 'none'); });
});

// starting the script on page load
$(document).ready(function(){
	tooltip();
});


//www.dhtmlgoodies.com
//Alf Magne Kalleland

//	************************************************************************************************************/

var slideTimeBetweenSteps = 50; // General speed variable (Lower = slower)


var scrollingContainer = false;
var scrollingContent = false;
var containerHeight;
var contentHeight;

var contentObjects = new Array();
var originalslideSpeed = false;
function slideContent(containerId) {
    var topPos = contentObjects[containerId]['objRef'].style.top.replace(/[^\-0-9]/g, '');
    topPos = topPos - contentObjects[containerId]['slideSpeed'];
    if (topPos / 1 + contentObjects[containerId]['contentHeight'] / 1 < 0) topPos = contentObjects[containerId]['containerHeight'];
    contentObjects[containerId]['objRef'].style.top = topPos + 'px';
    setTimeout('slideContent("' + containerId + '")', slideTimeBetweenSteps);

}

function stopSliding() {
    var containerId = this.id;
    contentObjects[containerId]['slideSpeed'] = 0;
}

function restartSliding() {
    var containerId = this.id;
    contentObjects[containerId]['slideSpeed'] = contentObjects[containerId]['originalSpeed'];

}
function initSlidingContent(containerId, slideSpeed) {
    scrollingContainer = document.getElementById(containerId);
    scrollingContent = scrollingContainer.getElementsByTagName('DIV')[0];

    scrollingContainer.style.position = 'relative';
    scrollingContainer.style.overflow = 'hidden';
    scrollingContent.style.position = 'relative';

    scrollingContainer.onmouseover = stopSliding;
    scrollingContainer.onmouseout = restartSliding;

    originalslideSpeed = slideSpeed;

    scrollingContent.style.top = '0px';

    contentObjects[containerId] = new Array();
    contentObjects[containerId]['objRef'] = scrollingContent;
    contentObjects[containerId]['contentHeight'] = scrollingContent.offsetHeight;
    contentObjects[containerId]['containerHeight'] = scrollingContainer.clientHeight;
    contentObjects[containerId]['slideSpeed'] = slideSpeed;
    contentObjects[containerId]['originalSpeed'] = slideSpeed;

    slideContent(containerId);

}

//Function to open Form Popup window -->

function openWin(windowURL, windowName) {
    window.open(windowURL, windowName,
"toolbar=0,location=0,resizable=0,scrollbars=0,status=0 height=270,width=450")
;
    return document.href;
}

// end of the function openWin()
function BoxPopUp() {
    myWindow = window.open("/offers.html", "Advert", " scrollbars=1, width=350, height=300, left=800, top=0");
}

// end of the function click(e)

function click(e) {

    //Disable right click script III- By Renigade (renigade@mediaone.net)
    //For full source code, visit http://www.dynamicdrive.com
    var alltables = document.getElementsByTagName("table")
    for (var i = 0; i < alltables.length; i++)
        disableSelection(alltables[i]) //disable text selection within all tables on the page
    var message = "";
    ///////////////////////////////////
    function clickIE() { if (document.all) { (message); return false; } }
    function clickNS(e) {
        if
(document.layers || (document.getElementById && !document.all)) {
            if (e.which == 2 || e.which == 3) { (message); return false; } 
        } 
    }
    if (document.layers)
    { document.captureEvents(Event.MOUSEDOWN); document.onmousedown = clickNS; }
    else { document.onmouseup = clickNS; document.oncontextmenu = clickIE; }

    document.oncontextmenu = new Function("return false")
}

if (document.layers) {
    document.captureEvents(Event.MOUSEDOWN);
}
document.onmousedown = click;

////////////////////////////////////




if (typeof (Sys) != "undefined") { Sys.Application.notifyScriptLoaded(); }