function popit(url,name,w,h) {
	var winl = (screen.width-w)/2;
	if (winl < 0) winl = 0;
	
	popwin = window.open(url,name,"width=" + w + ",height=" + h + ",toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,top=0,left=" + winl);
	popwin.focus();
}


function poplink(url,name) {
    isIE6 = /msie|MSIE 6/.test(navigator.userAgent);
    if (isIE6) {
        name="_blank";
    }
    if (name == '_blank') {
        try
          {
          pauseVid();
          }
        catch(err)
          {
          txt="There was an error on this page.\n\n";
          txt+="Error description: " + err.description + "\n\n";
          txt+="Click OK to continue.\n\n";
          //alert(txt);
          }
    }
	popwin = window.open(url,name);
	popwin.focus();
}

function poplink2(url,name) {
    location.href = url;
}


function trackhit(poo, stain, source_id, user_id, btn_id) {

	if (window.XMLHttpRequest) {
		xmlHttp=new XMLHttpRequest()
	} else if (window.ActiveXObject) {
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP")
	}
			
	var dt = new Date();
	var ms = dt.getMilliseconds();
	var dtms = dt + ":" + ms;
	var openpage = "hits.aspx?d35m@s36p=" + poo + "&qz76ut=" + stain + "&s=" + source_id + "&u=" + user_id + "&b=" + btn_id + "&dt=" + dtms;
	xmlHttp.open('GET',openpage);
	xmlHttp.send(null);
	
}

function trackvideo(poo, stain, video_id) {

	if (window.XMLHttpRequest) {
		xmlHttp=new XMLHttpRequest()
	} else if (window.ActiveXObject) {
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP")
	}
			
	var dt = new Date();
	var ms = dt.getMilliseconds();
	var dtms = dt + ":" + ms;
	var openpage = "hits.aspx?d35m@s36p=" + poo + "&qz76ut=" + stain + "&b=" + video_id + "&dt=" + dtms;
	xmlHttp.open('GET',openpage);
	xmlHttp.send(null);
	
}
function ValidateMe() {
    var ok = Page_ClientValidate();
    if (ok) {
        var pager = "pcoupon.aspx?fName=" + document.getElementById('tbFName').value + "&lName=" + document.getElementById('tbLName').value;
        //popit(pager, 'vouch', '850', '600');
        //switchvid();
    } else {
        return false;
    }
}



    // Switch video when button is clicked
    function switchvid() {
        //alert(window.document.vid);
        //if (navigator.appName.indexOf("Microsoft") != -1) {
        //var flash = window.vid;
        //} else {
        var flash = window.document.hc
        //}
       flash.switchvid_js();
    }
    
    function pauseVid() {
       var flash = window.document.hc
       flash.pausevid_js();
    }