﻿jQuery.noConflict();

function popPage(strPage) {
    tb_show('', strPage + '?keepThis=true&TB_iframe=true&modal=true', null);
}

function popVideoPlayer() {
    var funcArgs = popVideoPlayer.arguments;
    var destURL = '';
    var destWidth = '908';
    var destHeight = '760';
    var destScroll = '0';
    //alert(funcArgs.length);
    if(funcArgs.length > 0) {
        for(var i=0; i< funcArgs.length; i++) {
            if (i == 0)
                destURL = funcArgs[i];
            if (i == 1)
                destWidth = funcArgs[i];
            if (i == 2)
                destHeight = funcArgs[i];
            if (i == 3)
                destScroll = funcArgs[i];
        }
    }

    window.open(destURL, 'video', 'width=' + destWidth + ',height=' + destHeight + ',scrollbars=' + destScroll + ',toolbar=false,menu=false,location=false,status=false,resizable=true');
}

function imgSwap(oImg) {
   var strOver  = "-On";
   var strOff = "-Off";
   var strImg = oImg.src;
   if (strImg.indexOf(strOver) != -1) 
      oImg.src = strImg.replace(strOver,strOff)
   else
      oImg.src = strImg.replace(strOff,strOver)
}

String.prototype.endsWith = function(value) {
    return value.match(/value$/i);
}

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function jqModalPopup(modal, site, height) {
    divId = "#" + modal;
    jQuery(divId).jqmShow();
    createCookie("siteCookie", site);
}

function leaveSite() {
    window.open(readCookie("siteCookie"), '_blank');
}

//Open new window
function openWin() {
   	args = openWin.arguments;

   	/*--- Choose window size (full screen minus how many pixels) ---*/
   	var windowsize = 150;
   	/*--------------------------------------------------------------*/

   	var width = screen.width - windowsize;
   	var height = screen.height - (windowsize * 2);
   	var widthc = windowsize / 2;
   	var heightc = windowsize / 2;
   	window.open(args[0], 'openWin', 'width=' + width + ',height=' + height + ',top=' + heightc + ',left=' + widthc + ',scrollbars=1,status=1,toolbar=1,menubar=1,resizable=1');
   	return false;
}

jQuery().ready(function () {

});

