/*
'<!--$$Revision: 1 $-->
'<!--$$Author: david $-->
'<!--$$Date: 21/04/08 11:00a $-->
'<!--$$Logfile: /collectZing2/includes/global.js $-->
'<!--$$NoKeywords: $-->
*/
<!--
//document.onmousemove=mouseX();
var URLDomain="http://www.collectZing.com/"

//var URLDomain="http://dev.collectzing.com/"

var tempX = 0;
var getById = (typeof document.getElementById != "undefined");
function getRef(obj){
    if(getById)
    	return(typeof obj == "string") ? document.getElementById(obj) : obj;
}
function isImage(file){
	var ext = file.substr(file.lastIndexOf('.')).toLowerCase()
	return '.gif,.jpg,.jpeg,.jpg'.indexOf(ext+',') >= 0
}
function isValidFile(file){
	var ext = file.substr(file.lastIndexOf('.')).toLowerCase()
	return '.doc,.pdf,.docx,.doc'.indexOf(ext+',') >= 0
}
function URLEncode(inputString)
{
// ====================================================================
//       URLEncode and URLDecode functions
//
// Copyright Albion Research Ltd. 2002
// http://www.albionresearch.com/
//
// You may copy these functions providing that 
// (a) you leave this copyright notice intact, and 
// (b) if you use these functions on a publicly accessible
//     web site you include a credit somewhere on the web site 
//     with a link back to http://www.albionresearch.com/
//
// If you find or fix any bugs, please let us know at albionresearch.com
//
// SpecialThanks to Neelesh Thakur for being the first to
// report a bug in URLDecode() - now fixed 2003-02-19.
// And thanks to everyone else who has provided comments and suggestions.
// ====================================================================
	// The Javascript escape and unescape functions do not correspond
	// with what browsers actually do...
	var SAFECHARS = "0123456789" +					// Numeric
					"ABCDEFGHIJKLMNOPQRSTUVWXYZ" +	// Alphabetic
					"abcdefghijklmnopqrstuvwxyz" +
					"-_.!~*'()";					// RFC2396 Mark characters
	var HEX = "0123456789ABCDEF";
	var plaintext = inputString;
	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 += "+";
				encoded += ch;
			} else {
				encoded += "%";
				encoded += HEX.charAt((charCode >> 4) & 0xF);
				encoded += HEX.charAt(charCode & 0xF);
			}
		}
	} // for
	return encoded;
};

function openCommentForm() {
document.getElementById("divCommentForm").style.height="325px";
document.getElementById("divCommentForm").style.visibility="visible";
}

function makeLeftColStats() {
}
function addTag(tag,tagFld) {
	var fld=document.getElementById(tagFld)
	if (fld.value=="") {
	if (fld) {fld.value=fld.value=tag}
	} else {
	if (fld) {fld.value=fld.value+", "+tag}
	}
}
function MM_changeProp(objName,x,theProp,theValue) { //v6.0
  var obj = MM_findObj(objName);
  if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
    if (theValue == true || theValue == false)
      eval("obj."+theProp+"="+theValue);
    else eval("obj."+theProp+"='"+theValue+"'");
  }
}
function MM_openBrWindow(theURL,winName,features) {
  window.open(theURL,winName,features);
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
function isValidFile(file){
	var ext = file.substr(file.lastIndexOf('.')).toLowerCase()
	return '.pdf,.doc,.xls,.jpg,.jpeg,.png,.zip,.ppt,.tif,.gif,.gif'.indexOf(ext+',') >= 0
}
// Validates password
function validatePW(newPW) {
	var pw = newPW;
	tomatch = /^[a-zA-Z0-9_]+$/;  //regular expression shortcut would be /^\w+$/
	if (!tomatch.test(pw)) {		
		return true;
	} 
	return false;
}
function validateUN(newUN) {
	var un = newUN;
	tomatch = /[a-zA-Z0-9_]+$/;  //regular expression shortcut would be /^\w+$/
	if (!tomatch.test(un)) {		
		return true;
	} 
	return false;
}
function printWindow(){
   bV = parseInt(navigator.appVersion)
   if (bV >= 4) window.print()
}
function y2k(number) { return (number < 1000) ? number + 1900 : number; }
function isDate (day,month,year) {
    var today = new Date();
    year = ((!year) ? y2k(today.getYear()):year);
    month = ((!month) ? today.getMonth():month-1);
    if (!day) return false
    var test = new Date(year,month,day);
    if ( (y2k(test.getYear()) == year) &&
         (month == test.getMonth()) &&
         (day == test.getDate()) )
        return true;
    else
        return false
}
function mouseX(evt) {
	if (evt.pageX) { 
		tempX= evt.pageX;
	} else { 
			if (evt.clientX) {
		 tempX= evt.clientX + (document.documentElement.scrollLeft ?
		 document.documentElement.scrollLeft :
		 document.body.scrollLeft);
	} else {
		tempX= null;
	}
	}
}
function mouseY(evt) {
if (evt.pageY) return evt.pageY;
else if (evt.clientY)
   return evt.clientY + (document.documentElement.scrollTop ?
   document.documentElement.scrollTop :
   document.body.scrollTop);
else return null;
}
function countChars(txtFld,txtFldLabel,countFld,maxChars){
	objTxtFld= getRef(txtFld);
	objCountFld= getRef(countFld);
	if (objTxtFld.value=="") {
	objCountFld.innerHTML="0 characters of "+maxChars;
	} else {
	objCountFld.innerHTML=objTxtFld.value.length+" characters of "+maxChars;
	}
	if (objTxtFld.value.length>maxChars)
	{
	alert("Please keep '" + txtFldLabel + "' to less than " + maxChars + " characters.");
	objTxtFld.focus();
	return (false);
	}
}
function selectSearchAction(tagSourceId) {
	if (tagSourceId==0) {document.FormSearch.action="market.asp"} 
	else if (tagSourceId==4) {document.FormSearch.action="clubs.asp"}
	else {document.FormSearch.action="search.asp"};
}
-->