/* NEW MATCH TRACKER*/
function openTracker(w) {
       OpenWin =
this.open(w,'','toolbar=1,location=1,status=0,menubar=1,scrollbars=0,resizable=0,width=720,height=650');
}

/* Match Tracker Script */
function openT(w) {
       OpenWin =
this.open(w,'','toolbar=1,location=0,status=0,menubar=1,scrollbars=0,resizable=0,width=730,height=520');
}

/* TICKER POP-UP*/
function openTickerPopup(w) {
       OpenWin =
this.open(w,'','toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0,width=392,height=90');
}

/* Golf Leaderboard Script */
function openGolf(w) {
       OpenWin = this.open(w,'CtrlWindow','toolbar=0,status=0,scrollbars=1,resizable=1,width=530,height=560A');
}

function globalNavSubmit() {
location.href= document.forms[0].selectURL.options[document.forms[0].selectURL.selectedIndex].value; 
}

/* Domestic Match Tracker Script */
function openD(w) {
       OpenWin = this.open(w,'CtrlWindow','toolbar=0,status=0,scrollbars=1,resizable=1,width=460,height=460');
}

/* Heineken Script */
function openH(w) {
       OpenWin = this.open(w,'CtrlWindow','toolbar=1,status=0,scrollbars=1,resizable=1,width=475,height=500');
}

/* Chat Room Script */
function openC(w) {
       OpenWin = this.open(w,'CtrlWindow','toolbar=1,status=0,scrollbars=1,resizable=1,width=850,height=500');
}


/* Message Board Script */
function open_img(url) {mywin = window.open(url,"win2",'toolbar=1,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=790,height=550');}

/* RugbyWorld Message Board Script */
function open_rw(url) {mywin = window.open(url,"win2",'toolbar=1,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=764,height=600');}


/* News pop-up Script */
function openW(w) {
       OpenWin = this.open(w,'CtrlWindow','toolbar=1,status=0,scrollbars=1,resizable=1,width=515,height=400');
}



/* super12 teams popup Script */
function openI(w) {
       OpenWin = this.open(w,'CtrlWindow','toolbar=1,status=0,scrollbars=0,resizable=1,width=500,height=400');
}



/* Ericsson Picture of the Day Script */
function openE(w) {
       OpenWin = this.open(w,'CtrlWindow','toolbar=1,status=0,scrollbars=1,resizable=1,width=700,height=520');
}



/* Player of the week Script */
function openP(w,theURL,winName,features) {
       OpenWin = this.open(w,'potw','toolbar=0,status=0,scrollbars=1,resizable=1,width=640,height=400');
}



/* Open G Script (?) */
 function openG(w){
       OpenWin =
 this.open(w,'CtrlWindow','toolbar=0,status=0,scrollbars=0,resizable=0,width=778,height=570');
 }
 
/* Open Audio Pop-up */
 function mypopupaudio(w) {
	window.open(w,'','width=510,height=245,directories=no,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,resizable=no');
}


/*ericsson Quote of the day*/
 function openI(w){
       OpenWin =
 this.open(w,'CtrlWindow','toolbar=0,status=0,scrollbars=0,resizable=0,width=530,height=240');
 }

function openL(w){yourwin = window.open
 (w,'CtrlWindow','toolbar=0,status=0,scrollbars=0,resizable=0,width=500,height=420');
 }

 


 /* Privacy Checker */
function submitform(txt)
{
  nameOfForm = txt.name;
  
  if (form_check(nameOfForm) != true) { return false; }
  else 
  {
    if (checkbox(nameOfForm) != true) { return false; }
    else
      document.forms[nameOfForm].submit();
  }

}

function IsEmailValid(text)
{
  var EmailOk  = true;
  var AtSym    = text.indexOf('@');
  var Period   = text.lastIndexOf('.');
  var Space    = text.indexOf(' ');
  var Length   = text.length - 1;

  if ((AtSym < 1) || 
    (Period <= AtSym+1) ||
    (Period == Length ) ||
    (Space  != -1))
    {
      EmailOk = false;
    }
    return EmailOk;
}


function form_check(txt) 
{
  if (document.forms[txt].firstname.value == "") 
  {
  alert ("Please Complete The Name Field");
  document.forms[txt].firstname.focus()
  return false;
  }
  
 
  
  if (document.forms[txt].email.value == "") 
  {
    alert ("Please Complete The Email Field");
    document.forms[txt].email.focus()
    return false;
  }

  if (!IsEmailValid(document.forms[txt].email.value))
  {
    alert("Please Supply A Valid Email Address");
    document.forms[txt].email.focus()
    return false;
  }
  
  return true; 
}

function checkbox(txt)
{
  if (document.forms[txt].details.checked)
  { return true; }
  else
  {
    alert ("Sorry, you did not check the box.\nIf you wish to proceed, please check the box,\nthereby confirming your consent to our privacy policy.");
    return false;
  }
}

/* End Privacy Checker */

  /* Privacy Checker */
function submitform2(txt)
{
  nameOfForm = txt.name;
  
  if (form_check(nameOfForm) != true) { return false; }
  else 
  {
    if (checkbox(nameOfForm) != true) { return false; }
    else
      document.forms[nameOfForm].submit();
  }

}


/* End Privacy Checker */
function URLEncode( )
{
	// The Javascript escape and unescape functions do not correspond
	// with what browsers actually do...
	var SAFECHARS = "0123456789" +					// Numeric
					"ABCDEFGHIJKLMNOPQRSTUVWXYZ" +	// Alphabetci
					"abcdefghijklmnopqrstuvwxyz" +
					"-_.!~*'()";					// RFC2396 Mark characters
	var HEX = "0123456789ABCDEF";
	var plaintext = window.location.href;
	var encoded = "";
	for (var i = 0; i < plaintext.length; i++ ) {
		var ch = plaintext.charAt(i);
			    if (ch == " ") {
		    encoded += "+";				// x-www-urlencoded, rather than %20
		} else if (SAFECHARS.indexOf(ch) != -1) {
		    encoded += ch;
		} else {
		    var charCode = ch.charCodeAt(0);
			if (charCode > 255) {
			    alert( "Unicode Character '" + ch + "' cannot be encoded using standard URL encoding.\n" +
				        "(URL encoding only supports 8-bit characters.)\n" +
						"A space (+) will be substituted." );
				encoded += "+";
			} else {
				encoded += "%";
				encoded += HEX.charAt((charCode >> 4) & 0xF);
				encoded += HEX.charAt(charCode & 0xF);
			}
		} 
	} // for

	document.write('<img src="http://weblog.rivalsdm.com/nocache/trans.gif?' + encoded + '" width=1 height=1 border=0>');
	
	return false;
}

function BrowserInfo()
{
	this.ver=navigator.appVersion;
	this.dom=document.getElementById?1:0;
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom)?1:0;
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
	this.ie4=(document.all && !this.dom)?1:0;
	this.ns6=(this.dom && parseInt(this.ver) >= 5 && parseInt(this.ver) < 7)?1:0;
	this.ns7=(this.dom && parseInt(this.ver) >= 7 && parseInt(this.ver) < 8)?1:0;
	this.ns4=(document.layers && !this.dom)?1:0;
	this.w3c=(this.ie5 || this.ie6 || this.ns6);
	this.ie=(this.ie4 || this.ie5 || this.ie6);
	this.ns=(this.ns4 || this.ns6);
	this.bw=(this.ie4 || this.ie5 || this.ie6 || this.ns4 || this.ns6);
	this.dhtml=(this.ie || this.ns7);
	return this;
}

var UserBrowser = new BrowserInfo();