//<script>

var contacts=new Array();
contacts[0]=["here", "enquiries[at]dvdorchard[dot]com.au"];
contacts[1]=["here", "orders[at]dvdorchard[dot]com.au"];
contacts[2]=["here", "support[at]dvdorchard[dot]com.au"];
contacts[3]=["here", "marketing[at]dvdorchard[dot]com.au"];
contacts[4]=["here", "advertising[at]dvdorchard[dot]com.au"];
contacts[5]=["here", "sales[at]dvdorchard[dot]com.au"];
contacts[6]=["here", "affiliates[at]dvdorchard[dot]com.au"];
contacts[7]=["here", "customercare[at]dvdorchard[dot]com.au"];
contacts[8]=["here", "richard[at]dvdorchard[dot]com.au"];
contacts[9]=["here", "feedback[at]dvdorchard[dot]com.au"];

var numb = '0123456789';
var lwr = 'abcdefghijklmnopqrstuvwxyz';
var upr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';

function isValid(parm,val) 
	{
	if (parm == "") return true;
	for (i=0; i<parm.length; i++) 
		{
		if (val.indexOf(parm.charAt(i),0) == -1) return false;
		}
	return true;
	}

function isNumber(parm) 
	{
	return isValid(parm,numb);
	}
function isLower(parm) 
	{
	return isValid(parm,lwr);
	}
function isUpper(parm) 
	{
	return isValid(parm,upr);
	}
function isAlpha(parm) 
	{
	return isValid(parm,lwr+upr);
	}
function isAlphanum(parm) 
	{
	return isValid(parm,lwr+upr+numb);
	} 

var cookiesEnabled = false;
// Check whether cookies enabled
   	document.cookie = "Enabled=true";
	var cookieValid = document.cookie;
   
// if retrieving the VALUE we just set actually works 
// then we know cookies enabled
if (cookieValid.indexOf("Enabled=true") != -1)
	{
	cookiesEnabled = true;
	}
	else
	{
	cookiesEnabled = false;
	}

// Retrieves particular cookie
function getCookie(cookieName)
	{
	var cookieFoundAt;
	var cookieValue;
 
	// find start position in cookie string
	cookieFoundAt = document.cookie.indexOf(cookieName + "=");
   
	if (cookieFoundAt < 0)
		{
        cookieValue = "";
		}
	else
		{
        // move to actual start of cookie's data
        cookieFoundAt = document.cookie.indexOf("=",cookieFoundAt);
        cookieFoundAt++;
         
        // find end position of cookie's data
        cookieEnd = document.cookie.indexOf(";", cookieFoundAt);
        if (cookieEnd == -1)
			{
            cookieEnd = document.cookie.length - 1;
            }
			cookieValue = document.cookie.substring(cookieFoundAt,cookieEnd);
		}
		return cookieValue;
	}

function NCPCCDChk(ncpcno, ncpclst)
	{
	// number is 6 digits, check digit is 1 digit
	
	var chkdigit2;

	var ncpcAdig = new Number(ncpcno.substr(0,1));
	var ncpcBdig = new Number(ncpcno.substr(1,1));
	var ncpcCdig = new Number(ncpcno.substr(2,1));
	var ncpcDdig = new Number(ncpcno.substr(3,1));
	var ncpcEdig = new Number(ncpcno.substr(4,1));
	var ncpcFdig = new Number(ncpcno.substr(5,1));

	var ncpcct;
	var ncpccdSTR;

	// digit 6
	ncpccd = ncpcFdig * 2;
	ncpccdSTR = ncpccd.toString();
	if (ncpccd < 10)
		{
		ncpcct = ncpccd;
		}
	else
		{		 
		ncpcct = Number(ncpccdSTR.substr(0,1)) + Number(ncpccdSTR.substr(1,1));		
		}

	// digit 5
	ncpccd = ncpcEdig;
	ncpcct = ncpcct + ncpccd;

	// digit 4
	ncpccd = ncpcDdig * 2;
	ncpccdSTR = ncpccd.toString();
	if (ncpccd < 10)
		{
		ncpcct = ncpcct + ncpccd;
		}
	else
		{		 
		ncpcct = ncpcct + Number(ncpccdSTR.substr(0,1)) + Number(ncpccdSTR.substr(1,1));		
		}

	// digit 3
	ncpccd = ncpcCdig;
	ncpcct = ncpcct + ncpccd;

	// digit 2
	ncpccd = ncpcBdig * 2;
	ncpccdSTR = ncpccd.toString();
	if (ncpccd < 10)
		{
		ncpcct = ncpcct + ncpccd;
		}
	else
		{		 
		ncpcct = ncpcct + Number(ncpccdSTR.substr(0,1)) + Number(ncpccdSTR.substr(1,1));		
		}

	// digit 1
	ncpccd = ncpcAdig;
	ncpcct = ncpcct + ncpccd;

	var ncpccdA = ncpcct / 10;
	ncpccd = parseInt(ncpccdA);
	ncpccd = ncpcct - (ncpccd * 10);
	chkdigit2 = 10 - ncpccd;
	if (chkdigit2 == 10)
		{
		chkdigit2 = 0;
		}

	if (ncpclst != chkdigit2)
		{
		return false;
		}
	return true;
	}

function displaycontact(emailarray, displaymethod)
{
if (displaymethod=="text")
	{
	document.write('<a href="mailto:' + modifyemail(emailarray[1])+ '">'+ emailarray[0] + '</a>')
	}
	else if (displaymethod=="image")
	{
	document.write('<a href="mailto:' + modifyemail(emailarray[1])+ '"><img height="18" src="./images/mail.gif" width="30" border="0"></a>')
	}
}

function modifyemail(emailitem)
	{
	var modified=emailitem.replace(/\[at]/gi, "@")
	modified=modified.replace(/\[dot]/gi, ".")
	return modified
	}

IE4 = document.all;

function newAlert(title,mess,icon,mods) {
   (IE4) ? makeMsgBox(title,mess,icon,0,0,mods) : alert(mess);
}

function newConfirm(title,mess,icon,defbut,mods) {
   if (IE4) {
      icon = (icon==0) ? 0 : 2;
      defbut = (defbut==0) ? 0 : 1;
      retVal = makeMsgBox(title,mess,icon,4,defbut,mods);
      retVal = (retVal==6);
   }
   else {
      retVal = confirm(mess);
   }
   return retVal;
}

function newPrompt(title,mess,def) {
   retVal = (IE4) ? makeInputBox(title,mess,def) : prompt(mess,def);
   return retVal;
}

function IEBox(title,mess,icon,buts,defbut,mods) {
   retVal = (IE4) ? makeMsgBox(title,mess,icon,buts,defbut,mods) : null;
   return retVal;
}


// defaults the cursor to start on the left menu title search string
function window_onload()
	{
	document.thisForm.TitleSearch.focus();
	document.thisForm.TitleSearch.select(); 

	//if(document.images)
	//	{
	//	for(i=0;i<document.images.length;i++)
	//		{
	//		document.images[i].onmousedown = right;
	//		document.images[i].onmouseup = right;
	//		}
	//	}
	}

function KeyPress(e) 
	{
    var key;

    if(window.event) // IE
		{
    	key = e.keyCode;     

	    if (key == 13)
			{
			window.event.keyCode = 0;
			thisPage._fireEvent('btnTitleSearch','onclick');
			}
    	}
	else if(e.which) // Netscape/Firefox/Opera
        {
		key = e.which;     

	    if (key == 13)
			{
			var btn = document.createEvent("MouseEvents");
            btn.initMouseEvent("click",false,true,window,document.getElementById("btnTitleSearch"),0, 0, 0, 0, false, false, false, false, 0, null);
            var cb = document.getElementById("btnTitleSearch");
            cb.dispatchEvent(btn);
            return false;
			}

    	}

	}

function KeyPressTEST(e) 
	{
    var key;

    if(window.event) // IE
		{
    	key = e.keyCode;     

	    if (key == 13)
			{
			alert("IE - Key is " + key);
			window.event.keyCode = 0;
			thisPage._fireEvent('btnTitleSearch','onclick');
			}
    	}
	else if(e.which) // Netscape/Firefox/Opera
        {
		key = e.which;     

	    if (key == 13)
			{
			alert("Firefox - Key is " + key);

			var btn = document.createEvent("MouseEvents");
            btn.initMouseEvent("click",false,true,window,document.getElementById("btnTitleSearch"),0, 0, 0, 0, false, false, false, false, 0, null);
            var cb = document.getElementById("btnTitleSearch");
            cb.dispatchEvent(btn);
            return false;
			}

    	}

	}

function KeyPressUP(e) 
	{
    var key;

    if(window.event) // IE
		{
    	key = e.keyCode;     

	    if (key == 13)
			{
			window.event.keyCode = 0;
			thisPage._fireEvent('btnUpdate','onclick');
			}
    	}
	else if(e.which) // Netscape/Firefox/Opera
        {
		key = e.which;     

	    if (key == 13)
			{
			var btn = document.createEvent("MouseEvents");
            btn.initMouseEvent("click",false,true,window,document.getElementById("btnUpdate"),0, 0, 0, 0, false, false, false, false, 0, null);
            var cb = document.getElementById("btnUpdate");
            cb.dispatchEvent(btn);
            return false;
			}

    	}

	}

function KeyPressLogin(e) 
	{
    var key;

    if(window.event) // IE
		{
    	key = e.keyCode;     

	    if (key == 13)
			{
			window.event.keyCode = 0;
			thisPage._fireEvent('btnLogin','onclick');
			}
    	}
	else if(e.which) // Netscape/Firefox/Opera
        {
		key = e.which;     

	    if (key == 13)
			{
			var btn = document.createEvent("MouseEvents");
            btn.initMouseEvent("click",false,true,window,document.getElementById("btnLogin"),0, 0, 0, 0, false, false, false, false, 0, null);
            var cb = document.getElementById("btnLogin");
            cb.dispatchEvent(btn);
            return false;
			}

    	}

	}

function passwordcheckCC()
	{
	pass = document.thisForm.pword.value;
	if (newPrompt("dvdorchard Privacy & Security check","To help us maintain your Privacy and Security please re-enter your dvdorchard account password.  Please remember that your password is case-sensitive.","password")!= pass )
		{
		document.location="http://www.dvdorchard.com.au/invalidpassword.asp?TargetProg=updateccdets.asp";
		}
	}

var objWin;			//hold a reference to new window
function openWindow(docref)
	{
	objWin = window.open(docref,"new_win","resizable=no," +
			 "scrollbars=no,toolbar=no,location=no,directories=no,status=no," +
			 "menubar=no,width=160,height=200,top=100,left=100");
	/*objWinTimer = window.setTimeout("closeWindow()",1000);*/
	}

function window_onbeforeunload()
	{
	var manselected;
	var rat;
	for (i=0; i<document.thisForm.optCustRating.length; i++)
		if (document.thisForm.optCustRating[i].checked)
		{
		rat = (document.thisForm.optCustRating[i].value)
		manselected = "http://www.dvdorchard.com.au/custrating.asp?rating=" + rat;
		openWindow(manselected);
		objWin.location.href = manselected;
		}
	}

function textRemaining()
	{
	var oSizeBox = window.document.getElementById("sizebox");
	var oMessage = window.document.getElementById("message");

	oSizeBox.value = 160 - oMessage.innerText.length;
	
	if ( parseInt(oSizeBox.value) < 0 )
		{
		oSizeBox.style.color = "red";
		}
	else
		{
		oSizeBox.style.color = "black";
		}
	}

function textRemainingR()
	{
	var oSizeBox = window.document.getElementById("sizebox");
	var oReview = window.document.getElementById("review");

	oSizeBox.value = 1000 - oReview.innerText.length;
	
	if ( parseInt(oSizeBox.value) < 0 )
		{
		oSizeBox.style.color = "red";
		}
	else
		{
		oSizeBox.style.color = "black";
		}
	}

function MM_openBrWindow(theURL,winName,features) //v2.0
	{ 
	window.open(theURL,winName,features);
	}

function shippers(vl)
	{
	if (isNaN(vl.value))
		{
		alert("Please enter a number");
		return false;
		}
		return true;	
	}		

function numcheck(vl)
	{
	if (isNaN(vl.value))
		{
		alert("Please enter a number");
		return false;
		}
		thisPage._fireEvent('btnUpdateQty','onclick');
	}		

function MM_swapImgRestore() { //v3.0
	var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
	}

function MM_preloadImages() { //v3.0
	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
	}

function MM_findObj(n, d) { //v4.0
	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 && document.getElementById) x=document.getElementById(n); return x;
	}

function MM_swapImage() { //v3.0
	var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
	}

	var expireDate = new Date
	expireDate.setMonth(expireDate.getMonth()+6)
	var ScrRes = ""
	if(document.cookie != "")
	{
	ScrRes = document.cookie.split("=")[1]
	}
	ScrRes = screen.availWidth
	document.cookie = "ScrRes="+ScrRes+";expires=" + expireDate.toGMTString()

// Opening up Currency Conversion window
function openWindowS(docref)
	{
	objWinS = window.open(docref,"new_win","resizable=yes," +
			 "scrollbars=no,toolbar=no,location=no,directories=no,status=no," +
			 "menubar=no,width=500,height=540,top=10,left=10");
	/*objWinTimer = window.setTimeout("closeWindowS()",600000);*/
	}

// Opening up Currency Conversion window
function openCCWindow()
	{
	var manselected;
	var amt;
	var SpID;
	amt = (document.thisForm.ProdAmt.value)	
	SpID = (document.thisForm.ShpID.value)	

	manselected = "http://www.dvdorchard.com.au/currencyconverter.asp?ProdAmt=" + amt + "&ShipID=" + SpID;
	objWinS = window.open(manselected,"new_win","resizable=yes," +
			 "scrollbars=no,toolbar=no,location=no,directories=no,status=no," +
			 "menubar=no,width=500,height=540,top=10,left=10");
	}

// Opening up Currency Conversion window
function openCCPWindow()
	{
	var manselected;
	var amt;
	amt = (document.thisForm.ProdAmt.value)	

	manselected = "http://www.dvdorchard.com.au/currencyconverter.asp?ProdAmt=" + amt;
	objWinS = window.open(manselected,"new_win","resizable=yes," +
			 "scrollbars=no,toolbar=no,location=no,directories=no,status=no," +
			 "menubar=no,width=500,height=540,top=10,left=10");
	}

// Opening up Read Reviews window
function openRRWindow()
	{
	var ProdNo;
	ProdNo = (document.thisForm.PNDID.value)	

	manselected = "http://www.dvdorchard.com.au/readreviews.asp?PND=" + ProdNo;
	objWinS = window.open(manselected,"new_win","resizable=yes," +
			 "scrollbars=yes,toolbar=no,location=no,directories=no,status=no," +
			 "menubar=no,width=670,height=400,top=10,left=10");
	}

// Opening up Add Reviews window
function openARWindow()
	{
	var ProdNo;
	ProdNo = (document.thisForm.PNDID.value)	

	manselected = "http://www.dvdorchard.com.au/addreview.asp?PND=" + ProdNo;
	objWinS = window.open(manselected,"new_win","resizable=no," +
			 "scrollbars=no,toolbar=no,location=no,directories=no,status=no," +
			 "menubar=no,width=700,height=442,top=10,left=10");
	}

// Opening up AAE Courier Tracking window
function openAAEWindow()
	{
	var manselected;
	var con;
	con = (document.thisForm.ConsNumber.value)	

	manselected = "http://www.dvdorchard.com.au/TrackAAECons.asp?ConNbr=" + con;
	objWinA = window.open(manselected,"new_win","resizable=yes," +
			 "scrollbars=no,toolbar=no,location=no,directories=no,status=no," +
			 "menubar=no,width=900,height=540,top=10,left=10");
	}

// Opening up CCV Info window
function openWindowC(docref)
	{
	objWinC = window.open(docref,"new_win","resizable=yes," +
			 "scrollbars=no,toolbar=no,location=no,directories=no,status=no," +
			 "menubar=no,width=380,height=430,top=10,left=10");
	}

// Opening up FRInfo window
function openWindowFR()
	{
	var manselected;

	manselected = "http://www.dvdorchard.com.au/FRSignUp.asp";
	objWinFR = window.open(manselected,"new_win","resizable=yes," +
			 "scrollbars=no,toolbar=no,location=no,directories=no,status=no," +
			 "menubar=no,width=900,height=350,top=10,left=10");
	}


// Opening up Terms & Conditions window
function openWindowT(docref)
	{
	objWinC = window.open(docref,"new_win","resizable=yes," +
			 "scrollbars=yes,toolbar=no,location=no,directories=no,status=no," +
			 "menubar=no,width=400,height=400,top=10,left=10");
	}

// Opening up Terms & Conditions window
function openWindowSS(docref)
	{
	objWinC = window.open(docref,"new_win","resizable=yes," +
			 "scrollbars=yes,toolbar=no,location=no,directories=no,status=no," +
			 "menubar=no,width=380,height=300,top=10,left=10");
	}

function datestamp ()
	{
	var now = new Date ();
	var nowstr = new String ( now.toString() );
	var nowarr = nowstr.split (" ");
	return nowarr[2]+"-"+nowarr[1]+"-"+nowarr[nowarr.length-1];
	return "blah";
	}

function dts ()
	{
	var now = new Date ();
	var nowstr = new String ( now.toString() );
	var nowarr = nowstr.split (" ");
	return nowarr[2]+"-"+nowarr[1]+"-"+nowarr[nowarr.length-1]+" "+nowarr[3];
	}

function thisPage_onbeforeserverevent(obj, event )
	{
	if (obj=="btnLogin")
		{
		window.status='Logging you in now ... Please wait a moment';
		if(event=="onclick")
			{
			var accountname;
			accountname = document.thisForm.accountname.value;
			if (accountname.length < 1)
				{
				newAlert("dvdorchard Account Details check","Please enter your account name (your email address) in order to continue.",1,0);
				document.thisForm.accountname.focus();
				thisPage.cancelEvent = "true";
				return false;
				}
			if (accountname.length > 1 && !validEmail(document.thisForm.accountname.value))
				{
				newAlert("dvdorchard Account Details check","Please re-enter your account name (your email address) using a valid format!",1,0);
				document.thisForm.accountname.select();
				thisPage.cancelEvent = "true";
				return false;
				}
			var password;
			password = document.thisForm.password.value;
			if (password.length < 1)
				{
				newAlert("dvdorchard Account Details check","Please enter your password in order to continue.",1,0);
				document.thisForm.password.focus();
				thisPage.cancelEvent = "true";
				return false;
				}
			return true;
			}
		}

	if (obj=="btnNewAccount")
		{
		window.status='Processing your request for a new dvdorchard account now ... Please wait a moment';
		if(event=="onclick")
			{
			var firstname;
			firstname = document.thisForm.firstname.value;
			if (firstname.length < 2)
				{
				newAlert("dvdorchard Account Details check","Please enter your first name (no initials please) in order to continue.",1,0);
				document.thisForm.firstname.focus();
				thisPage.cancelEvent = "true";
				return false;
				}
			var lastname;
			lastname = document.thisForm.lastname.value;
			if (lastname.length < 2)
				{
				newAlert("dvdorchard Account Details check","Please enter your last name in order to continue.",1,0);
				document.thisForm.lastname.focus();
				thisPage.cancelEvent = "true";
				return false;
				}
			var newaccountname;
			newaccountname = document.thisForm.newaccountname.value;
			if (newaccountname.length < 6)
				{
				newAlert("dvdorchard Account Details check","Please enter a valid email address in order to continue.",1,0);
				document.thisForm.newaccountname.focus();
				thisPage.cancelEvent = "true";
				return false;
				}
			if (newaccountname.length > 49)
				{
				newAlert("dvdorchard Account Details check","Please enter an email address with less than 50 characters in order to continue.",1,0);
				document.thisForm.newaccountname.focus();
				thisPage.cancelEvent = "true";
				return false;
				}
			if (newaccountname.length > 0 && !validEmail(document.thisForm.newaccountname.value))
				{
				newAlert("dvdorchard Account Details check","Please re-enter your email address using a valid format!",1,0);
				document.thisForm.newaccountname.select();
				thisPage.cancelEvent = "true";
				return false;
				}
			var newaccountname2;
			newaccountname2 = document.thisForm.newaccountname2.value;
			if (newaccountname2.length < 6)
				{
				newAlert("dvdorchard Account Details check","Please enter your email address again in order to continue.",1,0);
				document.thisForm.newaccountname2.focus();
				thisPage.cancelEvent = "true";
				return false;
				}
			if (newaccountname != newaccountname2)
				{
				newAlert("dvdorchard Account Details check","Please either re-enter the repeat email address or correct the original email address to ensure both are identical (and both are correct !). A valid email address will ensure we can contact you when we need to.",1,0);
				document.thisForm.newaccountname2.focus();
   				thisPage.cancelEvent = "true";
				return false;
				}
			var newpassword;
			newpassword = document.thisForm.newpassword.value;
			if (newpassword.length < 6)
				{
				newAlert("dvdorchard Account Details check","Please enter a valid password (6-12 characters) twice in order to continue.",1,0);
				document.thisForm.newpassword.focus();
   			    thisPage.cancelEvent = "true";
				return false;
				}
			if (newpassword.length > 12)
				{
				newAlert("dvdorchard Account Details check","Please enter a valid password (6-12 characters) twice in order to continue.",1,0);
				document.thisForm.newpassword.focus();
   			    thisPage.cancelEvent = "true";
				return false;
				}
			var newpassword2;
			newpassword2 = document.thisForm.newpassword2.value;
			if (newpassword2.length < 6)
				{
				newAlert("dvdorchard Account Details check","Please enter the same password again in order to continue.",1,0);
				document.thisForm.newpassword2.focus();
   			    thisPage.cancelEvent = "true";
				return false;
				}
			if (newpassword2.length > 12)
				{
				newAlert("dvdorchard Account Details check","Please enter the same password again in order to continue.",1,0);
				document.thisForm.newpassword2.focus();
   			    thisPage.cancelEvent = "true";
				return false;
				}
			if (newpassword != newpassword2)
				{
				newAlert("dvdorchard Account Details check","Please re-enter both new password fields identically.",1,0);
				document.thisForm.newpassword2.focus();
   				thisPage.cancelEvent = "true";
				return false;
				}

			var FndUs;
			FndUs = document.thisForm.mnuFoundUs.value;
			if (FndUs == 11)  // Promo Selection
				{
				var ncpcno = document.thisForm.FoundUsText.value;
				var ncpclen = ncpcno.length;

				if (ncpclen != 8)	
					{
					// if true
					newAlert("dvdorchard Promotion Code check","Sorry, the promotion code is incorrect or has not been provided.  It should be 8 characters long with a letter as the first character, 7 numbers following.",1,0);
					document.thisForm.FoundUsText.focus();
					thisPage.cancelEvent = "true";
					return false;
					}

				var ncpcfst = ncpcno.substring(0,1);
				var ncpcnum = ncpcno.substring(1,7);
				var ncpclst = ncpcno.substring(7,8);
				
				if (!isNumber(ncpcnum) || !isNumber(ncpclst) || !isAlpha(ncpcfst))	
					{
					// if true
					newAlert("dvdorchard Promotion Code check","Sorry, the promotion code is incorrect, should be 8 characters long with a letter as the first character, 7 numbers following.",1,0);
					document.thisForm.FoundUsText.focus();
					thisPage.cancelEvent = "true";
					return false;
					}
				
				if (!NCPCCDChk(ncpcnum,ncpclst))
 					{
					// if false
					newAlert("dvdorchard Promotion Code check","Sorry, the promotion code you have provided is invalid, please check and try again.",1,0);
					document.thisForm.FoundUsText.focus();
					thisPage.cancelEvent = "true";
					return false;
					}	
				}
			return true;
			}
		}
	if (obj=="btnMyAccount")
		{
		window.status='Processing your request to update your details now ... Please wait a moment';
		if(event=="onclick")
			{
			var accountname;
			accountname = document.thisForm.AccountName.value;
			if (accountname.length < 1)
				{
				newAlert("dvdorchard Account Details check","Please enter your email address as your account name in order to continue.",1,0);
				document.thisForm.AccountName.focus();
				thisPage.cancelEvent = "true";
				return false;
				}
			if (accountname.length > 1 && !validEmail(document.thisForm.AccountName.value))
				{
				newAlert("dvdorchard Account Details check","Please re-enter your email address using a valid format!",1,0);
				document.thisForm.AccountName.select();
				thisPage.cancelEvent = "true";
				return false;
				}
			return true;
			}
		}
	if (obj=="Button1")
		{
		if(event=="onclick")
			{
			var contact_name;
			contact_name = document.thisForm.Textbox3.value;
			if (contact_name.length < 1)
				{
				newAlert("dvdorchard Contact Details check","Please enter your name.",1,0);
			    document.thisForm.Textbox3.select();
				thisPage.cancelEvent = "true";
				return false;
				}
			var contact_details;
			contact_details = document.thisForm.Textbox4.value
			if (contact_details.length < 1)
				{
				newAlert("dvdorchard Contact Details check","How do we get in touch with you ?",1,0);
			    document.thisForm.Textbox4.select();
				thisPage.cancelEvent = "true";
				return false;
				}
			var email_address;
			email_address = document.thisForm.Textbox4.value;
			if (email_address.length > 1 && !validEmail(document.thisForm.Textbox4.value))
				{
				newAlert("dvdorchard Contact Details check","Please re-enter your email address using a valid format!",1,0);
				document.thisForm.Textbox4.focus();
				thisPage.cancelEvent = "true";
				return false;
				}
			var HFaccept;
			HFaccept = (document.thisForm.Checkbox1.checked);
			if (HFaccept == 0)
				{
				// if true
				newAlert("dvdorchard Help FAQ check","Please read the Help FAQ's prior to making contact us.  We have gone to great lengths to provide you with an immediate answer to most of your queries online. Thanks.",1,0);
				document.thisForm.Checkbox1.focus();
				thisPage.cancelEvent = "true";
				return false;
				}
			return true;
			}	
		}
	if (obj=="btnFind")
		{
		if(event=="onclick")
			{
			var accountname;
			accountname = document.thisForm.accountname.value;
			if (accountname.length < 1)
				{
				newAlert("dvdorchard Personal Details check","Please enter your email address in order to continue.",1,0);
				document.thisForm.accountname.select();
				thisPage.cancelEvent = "true";
				return false;
				}
			if (accountname.length > 1 && !validEmail(document.thisForm.accountname.value))
				{
				newAlert("dvdorchard Personal Details check","Please re-enter your email address using a valid format!",1,0);
				document.thisForm.accountname.focus();
				thisPage.cancelEvent = "true";
				return false;
				}
			return true;
			}
		}
	if (obj=="btnRegister")
		{
		if(event=="onclick")
			{
			var accountname;
			accountname = document.thisForm.accountname.value;
			if (accountname.length < 1)
				{
				newAlert("dvdorchard Contact Details check","Please enter your email address in order to continue.",1,0);
				document.thisForm.accountname.select();
				thisPage.cancelEvent = "true";
				return false;
				}
			if (accountname.length > 1 && !validEmail(document.thisForm.accountname.value))
				{
				newAlert("dvdorchard Contact Details check","Please re-enter your email address using a valid format!",1,0);
				document.thisForm.accountname.focus();
				thisPage.cancelEvent = "true";
				return false;
				}
			return true;
			}
		}

	if (obj=="btnRequestPassword")
		{
		if(event=="onclick")
			{
			var accountname;
			accountname = document.thisForm.accountname.value;
			if (accountname.length < 1)
				{
				newAlert("dvdorchard Account Details check","Please enter your account name (your email address).",1,0);
			    document.thisForm.accountname.select();
				thisPage.cancelEvent = "true";
				return false;
				}
			if (accountname.length > 1 && !validEmail(document.thisForm.accountname.value))
				{
				newAlert("dvdorchard Account Details check","Please re-enter your account name (your email address) using a valid format!",1,0);
				document.thisForm.accountname.focus();
				thisPage.cancelEvent = "true";
				return false;
				}
			return true;
			}	
		}
	if (obj=="btnChgPassword")
		{
		if(event=="onclick")
			{
			var newpassword;
			var oldpassword;
			newpassword = document.thisForm.newpassword.value;
			oldpassword = document.thisForm.password.value;
			if (newpassword.length < 6)
				{
				newAlert("dvdorchard Password Change check","Please enter a valid password (6-12 characters) twice in order to continue.",1,0);
				document.thisForm.newpassword.focus();
   			    thisPage.cancelEvent = "true";
				return false;
				}
			if (newpassword == oldpassword)
				{
				newAlert("dvdorchard Password Change check","Your new password must be different to your old. Please re-enter.",1,0);
				document.thisForm.newpassword.focus();
   				thisPage.cancelEvent = "true";
				return false;
				}
			var newpassword2;
			newpassword2 = document.thisForm.newpassword2.value;
			if (newpassword2.length < 1)
				{
				newAlert("dvdorchard Password Change check","Please type the same password again in order to continue.",1,0);
				document.thisForm.newpassword2.focus();
   			    thisPage.cancelEvent = "true";
				return false;
				}
			if (newpassword != newpassword2)
				{
				newAlert("dvdorchard Password Change check","Please re-enter both new password fields identically.",1,0);
				document.thisForm.newpassword2.focus();
   				thisPage.cancelEvent = "true";
				return false;
				}
			return true;
			}
		}
	if (obj=="btnTitleSearch")
		{
		window.status='Processing your search request now... Please wait a moment';
		}
	if (obj=="mnuGenres")
		{
		window.status='Processing your search by Genre request now... Please wait a moment';
		}
	if (obj=="btnAdvancedSearch")
		{
		window.status='Processing your advanced search request now... Please wait a moment';
		}
	if (obj=="mnuHelp")
		{
		window.status='Processing your Help Menu request now... Please wait a moment';
		}
	if (obj=="mnuSubSearch")
		{
		window.status='Processing your sub-search request now... Please wait a moment';
		}
	if (obj=="mnuBrandSearch")
		{
		window.status='Processing your Brand search request now... Please wait a moment';
		}
	if (obj=="mnuPlayerSearch")
		{
		window.status='Processing your Player search request now... Please wait a moment';
		}
	if (obj=="btnAddToWishlist")
		{
		window.status='Adding this item to your personal Wishlist now... Please wait a moment';
		}
	if (obj=="btnAddToLibrary")
		{
		window.status='Adding this item to your personal Library now... Please wait a moment';
		}
	if (obj=="btnAddToLibrary2")
		{
		window.status='Adding this item to your personal Library now... Please wait a moment';
		}
	if (obj=="btnAddToBasket")
		{
		window.status='Adding this item to your personal Shopping Basket now... Please wait a moment';
		}
	if (obj=="btnCalc")
		{
		window.status='Calculating the Shipping and Order Costs for this order now... Please wait a moment';
		}
	if (obj=="btnCalcShippingI")
		{
		window.status='Calculating an estimate of Shipping Costs now... Please wait a moment';
		}
	if (obj=="btnCalcShippingA")
		{
		window.status='Calculating an estimate of Shipping Costs now... Please wait a moment';
		}
	if (obj=="btnUpdateQty")
		{
		window.status='Updating quantities now... Please wait a moment';
		}
	if (obj=="mnuRecords")
		{
		window.status='Updating the number of records displayed now... Please wait a moment';
		}
	if (obj=="chkImages")
		{
		window.status='Updating coverart images now... Please wait a moment';
		}
	if (obj=="chkMyPrefs")
		{
		window.status='Updating list with your Preferences now... Please wait a moment';
		}
	if (obj=="chkDiscontinued")
		{
		window.status='Updating listing for Discontinued stock now... Please wait a moment';
		}
	if (obj=="chkSortOrder")
		{
		window.status='Reversing release date sort order now... Please wait a moment';
		}
	if (obj=="btnSave")
		{
		window.status='Processing your order now ..... Please wait a moment';
		if(event=="onclick")
			{
			var contact_var;
			contact_var = document.thisForm.FirstName.value;
			if (contact_var.length < 1)
				{
				newAlert("dvdorchard Personal Details check","Please enter your first name (no initials please).",1,0);
			    document.thisForm.FirstName.select();
				thisPage.cancelEvent = "true";
				return false;
				}
			var contact_var;
			contact_var = document.thisForm.LastName.value;
			if (contact_var.length < 1)
				{
				newAlert("dvdorchard Personal Details check","Please enter your last name.",1,0);
			    document.thisForm.LastName.select();
				thisPage.cancelEvent = "true";
				return false;
				}
			var contact_var;
			contact_var = document.thisForm.Salutation.value;
			if (contact_var.length < 1)
				{
				newAlert("dvdorchard Personal Details check","Please enter your salutation (Mr or Mrs etc).",1,0);
			    document.thisForm.Salutation.select();
				thisPage.cancelEvent = "true";
				return false;
				}
			var contact_var;
			contact_var = document.thisForm.DayPhoneNumber.value;
			if (contact_var.length < 1)
				{
				newAlert("dvdorchard Personal Details check","Please enter a day-time contact phone number.",1,0);
			    document.thisForm.DayPhoneNumber.select();
				thisPage.cancelEvent = "true";
				return false;
				}
			var contact_var;
			contact_var = document.thisForm.AHPhoneNumber.value;
			if (contact_var.length < 1)
				{
				newAlert("dvdorchard Personal Details check","Please enter an after hours contact phone number.",1,0);
			    document.thisForm.AHPhoneNumber.select();
				thisPage.cancelEvent = "true";
				return false;
				}
			var contact_var;
			contact_var = document.thisForm.billingstreet1.value;
			if (contact_var.length < 1)
				{
				newAlert("dvdorchard Personal Details check","Please enter the first line of your street or postal address as corresponds to your billing address.",1,0);
			    document.thisForm.billingstreet1.select();
				thisPage.cancelEvent = "true";
				return false;
				}
			var contact_var;
			contact_var = document.thisForm.billingcity.value;
			if (contact_var.length < 1)
				{
				newAlert("dvdorchard Personal Details check","Please enter the City corresponding to your billing address.",1,0);
			    document.thisForm.billingcity.select();
				thisPage.cancelEvent = "true";
				return false;
				}
			var contact_var;
			contact_var = document.thisForm.billingpostcode.value;
			if (contact_var.length < 1)
				{
				newAlert("dvdorchard Personal Details check","Please enter the Postcode or Zipcode corresponding to your billing address.",1,0);
			    document.thisForm.billingpostcode.select();
				thisPage.cancelEvent = "true";
				return false;
				}
			var contact_var;
			contact_var = document.thisForm.billingstate.value;
			if (contact_var.length < 1)
				{
				newAlert("dvdorchard Personal Details check","Please enter the State corresponding to your billing address.",1,0);
			    document.thisForm.billingstate.select();
				thisPage.cancelEvent = "true";
				return false;
				}
			var contact_var;
			contact_var = document.thisForm.shippingname.value;
			if (contact_var.length > 0)
				{
				// if true
				var contact_var;
				contact_var = document.thisForm.shippingstreet1.value;
				if (contact_var.length < 1)
					{
					// if true
					newAlert("dvdorchard Personal Details check","As you have populated at least one of the Shipping Address details you now need to populate all the other relevant fields in the group.",1,0);
					document.thisForm.shippingstreet1.select();
					thisPage.cancelEvent = "true";
					return false;
					}
				var contact_var;
				contact_var = document.thisForm.shippingcity.value;
				if (contact_var.length < 1)
					{
					// if true
					newAlert("dvdorchard Personal Details check","As you have populated at least one of the Shipping Address details you now need to populate all the other relevant fields in the group.",1,0);
					document.thisForm.shippingcity.select();
					thisPage.cancelEvent = "true";
					return false;
					}
				}

			var NB;
			NB = document.thisForm.NonBooks.value;
			if (NB == "1")
				{
				var jShipMeth;
				jShipMeth = document.thisForm.mnuShipMethod.value;
				if (jShipMeth == 7)
					{
					var tcaccept;
					tcaccept = (document.thisForm.chkAcceptSM.checked);
					if (tcaccept == 0)
						{
						// if true
						newAlert("dvdorchard Non Insured Air Mail condition check","You have chosen Non Insured Air-Mail over the Insured option.  We require that you confirm your acceptance of full responsibility in the event that your Air-Mail parcel is lost in transit or otherwise altered or diverted.  Check the appropriate box just before the Submit Order button and then re-submit your order.",1,0);
						document.thisForm.chkAcceptSM.focus();
						thisPage.cancelEvent = "true";
						return false;
						}
					}
			
				var jShipID;
				jShipID = document.thisForm.mnuShippingCountry.value;
				if (jShipID != 1 && jShipID != 0 && jShipID != 2)
					{
					var tcaccept;
					tcaccept = (document.thisForm.chkAcceptTC.checked);
					if (tcaccept == 0)
						{
						// if true
						newAlert("dvdorchard Regional Condition check","You must accept the regional conditions of this sale prior to submitting this order.  Check the appropriate box just before the Submit Order button and then re-submit your order.",1,0);
						document.thisForm.chkAcceptTC.focus();
						thisPage.cancelEvent = "true";
						return false;
						}
					}
				}

			var ordamt;
			ordamt = document.thisForm.ordcost.value;
			if (ordamt > 0)
				{
				var paymethod;
				for (i=0; i<document.thisForm.optPaymentMethod.length; i++)
				if (document.thisForm.optPaymentMethod[i].checked)
					{
					paymethod = (document.thisForm.optPaymentMethod[i].value);
					if (paymethod == 1)
						{
						var cardtype;
						var cardnumber;
						var ccvnumber;

						cardtype = document.thisForm.mnuCreditCardType.value;
						cardnumber = document.thisForm.CreditCardNumber.value;
						ccvnumber = document.thisForm.CreditCardValidNo.value;

						if (cardtype == 0)
							{
							// if true
							newAlert("dvdorchard Credit Card Details check","Please select the Credit Card type.",1,0);
							document.thisForm.mnuCreditCardType.focus();
							thisPage.cancelEvent = "true";
							return false;
							}
						if (cardnumber.length < 1)
							{
							// if true
							newAlert("dvdorchard Credit Card Details check","Please enter your Credit Card number using only numbers - no spaces or other characters.",1,0);
							document.thisForm.CreditCardNumber.focus();
							thisPage.cancelEvent = "true";
							return false;
							}
						if (!allDigits(cardnumber))
 							{
							// if false
							newAlert("dvdorchard Credit Card Details check","Please re-enter your Credit Card number using only numbers - no spaces or other characters.",1,0);
							document.thisForm.CreditCardNumber.focus();
							thisPage.cancelEvent = "true";
							return false;
							}	
					 	if (!LuhnCheck(cardnumber) || !validateCCNum(cardtype,cardnumber))
							{
							// if false
							newAlert("dvdorchard Credit Card Details check","The Credit Card number you have provided is invalid.  Please try again using only numbers - no spaces or other characters.",1,0);
							document.thisForm.CreditCardNumber.focus();
							thisPage.cancelEvent = "true";
							return false;
							}
						if (!allDigits(ccvnumber) || !validateCCVLength(cardtype,ccvnumber))
							{
							// if true
							newAlert("dvdorchard Credit Card Details check","Please enter a valid Credit Card Verification/security number (3 digits for Visa and M/C, 4 digits for Amex And Diners) - click on the adjacent links for information about this number if you are unsure.",1,0);
							document.thisForm.CreditCardValidNo.focus();
							thisPage.cancelEvent = "true";
							return false;
							}
						if (!validateCCV(cardtype,cardnumber,ccvnumber))
 							{
							// if false
							newAlert("dvdorchard Credit Card Details check","Please enter a valid 3 or 4 digit Credit Card verification/security number (3 digits for Visa and M/C, 4 digits for Amex And Diners) - this is NOT a part of your card number. Click on the adjacent links for information about this number if you are unsure.",1,0);
							document.thisForm.CreditCardValidNo.focus();
							thisPage.cancelEvent = "true";
							return false;
							}	
						var contact_var;
						contact_var = document.thisForm.mnuCreditCardExpiryMonth.value;
						if (contact_var == 0)
							{
							// if true
							newAlert("dvdorchard Credit Card Details check","Please select your Credit Cards expiry MONTH.",1,0);
							document.thisForm.mnuCreditCardExpiryMonth.focus();
							thisPage.cancelEvent = "true";
							return false;
							}
						var contact_var;
						contact_var = document.thisForm.mnuCreditCardExpiryYear.value;
						if (contact_var == 0)
							{
							// if true
							newAlert("dvdorchard Credit Card Details check","Please select your Credit Cards expiry YEAR.",1,0);
							document.thisForm.mnuCreditCardExpiryYear.focus();
							thisPage.cancelEvent = "true";
							return false;
							}
						var contact_var;
						contact_var = document.thisForm.CreditCardName.value;
						if (contact_var.length < 1)
							{
							// if true
							newAlert("dvdorchard Credit Card Details check","Please enter the name on your credit card (not your banks name - your name).",1,0);
							document.thisForm.CreditCardName.select();
							thisPage.cancelEvent = "true";
							return false;
							}
						}
					if (paymethod == 5)
						{
						var IPPcardnumber;
						IPPcardnumber = document.thisForm.iveprepaidNumber.value;

						if (!allDigits(IPPcardnumber))
 							{
							// if false
							newAlert("dvdorchard IvePrepaid Payment Details check","Please re-enter your IvePrePaid.com card/voucher number using only numbers - no spaces or other characters.",1,0);
							document.thisForm.iveprepaidNumber.focus();
							thisPage.cancelEvent = "true";
							return false;
							}	
						if (IPPcardnumber.substr(0,1) != 1)
							{
							// if false
							newAlert("dvdorchard IvePrepaid Payment Details check","The IvePrePaid.com card/voucher number you have provided is invalid.  Please try again using only numbers - no spaces or other characters.",1,0);
							document.thisForm.iveprepaidNumber.focus();
							thisPage.cancelEvent = "true";
							return false;
							}
						if (IPPcardnumber.length != 15)
							{
							// if false
							newAlert("dvdorchard IvePrepaid Payment Details check","The IvePrePaid.com card/voucher number you have provided is invalid.  Please try again using only numbers - no spaces or other characters.",1,0);
							document.thisForm.iveprepaidNumber.focus();
							thisPage.cancelEvent = "true";
							return false;
							}
						var IPPpassword;
						IPPpassword = document.thisForm.iveprepaidpassword.value;
						if (IPPpassword.length != 8)
							{
							// if true
							newAlert("dvdorchard IvePrepaid Payment Details check","Please re-enter your IvePrePaid.com password using only numbers - no spaces or other characters.",1,0);
							document.thisForm.iveprepaidpassword.focus();
							thisPage.cancelEvent = "true";
							return false;
							}
						if (!allDigits(IPPpassword))
 							{
							// if false
							newAlert("dvdorchard IvePrepaid Payment Details check","Please re-enter your IvePrePaid.com password using only numbers - no spaces or other characters.",1,0);
							document.thisForm.iveprepaidpassword.focus();
							thisPage.cancelEvent = "true";
							return false;
							}	
						}
					}
				}
			}		
		}		
	if (obj=="btnAdvancedSearch")
		{
		if(event=="onclick")
			{
			var a;
			a = document.thisForm.mnuType.value;
			var b;
			b = document.thisForm.mnuGenres2.value;
			var c;
			c = document.thisForm.mnuSuppliers.value;
			var d;
			d = document.thisForm.mnuRating.value;
			var e;
			e = document.thisForm.mnuAudio.value;
			var f;
			f = document.thisForm.mnuPrice.value;
			var g;
			g = document.thisForm.mnuRegion.value;
			var h;
			h = document.thisForm.mnuSystem.value;
			var i;
			i = document.thisForm.mnuLanguage.value;
			var j;
			j = document.thisForm.mnuSubTitles.value;
			var k;
			k = document.thisForm.mnuReleaseStatus.value;
			var l;
			l = document.thisForm.mnuDiscontinued.value;
			var b;
			n = document.thisForm.mnuSubGenres.value;
			var m=a+b+c+d+e+f+g+h+i+j+k+l+n;

			if (m < 3)
				{
				// if true
				newAlert("dvdorchard Advanced Search check","Please make a selection from at least 3 dropdown boxes prior to searching.",1,0);
				document.thisForm.mnuType.focus();
				thisPage.cancelEvent = "true";
				return false;
				}
			window.status='Processing your search request now ..... Please wait a moment';
			}	
		}
	if (obj=="btnSaveCC")
		{
		window.status='Processing any changes now ..... Please wait a moment';
		if(event=="onclick")
			{
			var contact_var;
			contact_var = document.thisForm.Gshippingname.value;
			if (contact_var.length > 0)
				{
				// if true
				var contact_var;
				contact_var = document.thisForm.Gshippingstreet1.value;
				if (contact_var.length < 1)
					{
					// if true
					newAlert("dvdorchard Personal Details check","As you have populated at least one of the Third Party Address details you now need to populate all the other relevant fields in the group.",1,0);
					document.thisForm.Gshippingstreet1.select();
					thisPage.cancelEvent = "true";
					return false;
					}
				var contact_var;
				contact_var = document.thisForm.Gshippingcity.value;
				if (contact_var.length < 1)
					{
					// if true
					newAlert("dvdorchard Personal Details check","As you have populated at least one of the Third Party Address details you now need to populate all the other relevant fields in the group.",1,0);
					document.thisForm.Gshippingcity.select();
					thisPage.cancelEvent = "true";
					return false;
					}
				}
			var paymth;
			paymth = document.thisForm.paymeth.value;
			if (paymth == 1)
				{
				var cardtype;
				cardtype = document.thisForm.mnuCreditCardType.value;
				if (cardtype == 0)
					{
					// if true
					newAlert("dvdorchard Credit Card Details check","Please select the Credit Card type.",1,0);
					document.thisForm.mnuCreditCardType.focus();
					thisPage.cancelEvent = "true";
					return false;
					}
				var cardnumber;
				cardnumber = document.thisForm.CreditCardNumber.value;
				if (cardnumber.length < 14)
					{
					// if true
					newAlert("dvdorchard Credit Card Details check","Please enter your Credit Card number using only numbers - no spaces or other characters.",1,0);
					document.thisForm.CreditCardNumber.focus();
					thisPage.cancelEvent = "true";
					return false;
					}
				if (!allDigits3(cardnumber))
 					{
					// if false
					newAlert("dvdorchard Credit Card Details check","Please re-enter your Credit Card number using only numbers - no spaces or other characters.",1,0);
					document.thisForm.CreditCardNumber.focus();
					thisPage.cancelEvent = "true";
					return false;
					}	
				var contact_var;
				contact_var = document.thisForm.CreditCardValidNo.value;
				if (contact_var.length < 3)
					{
					// if true
					newAlert("dvdorchard Credit Card Details check","Please enter a valid 3 or 4 digit Credit Card verification/security number - click on the links for information about this number if you are unsure.",1,0);
					document.thisForm.CreditCardValidNo.focus();
					thisPage.cancelEvent = "true";
					return false;
					}
				if (!allDigits(contact_var))
 					{
					// if false
					newAlert("dvdorchard Credit Card Details check","Please re-enter a valid 3 or 4 digit Credit Card verification/security number using ONLY NUMBERS. Click on the adjacent links for information about this number if you are unsure.",1,0);
					document.thisForm.CreditCardValidNo.focus();
					thisPage.cancelEvent = "true";
					return false;
					}	
				var contact_var;
				contact_var = document.thisForm.mnuCreditCardExpiryMonth.value;
				if (contact_var == 0)
					{
					// if true
					newAlert("dvdorchard Credit Card Details check","Please select your Credit Cards expiry MONTH.",1,0);
					document.thisForm.mnuCreditCardExpiryMonth.focus();
					thisPage.cancelEvent = "true";
					return false;
					}
				var contact_var;
				contact_var = document.thisForm.mnuCreditCardExpiryYear.value;
				if (contact_var == 0)
					{
					// if true
					newAlert("dvdorchard Credit Card Details check","Please select your Credit Cards expiry YEAR.",1,0);
					document.thisForm.mnuCreditCardExpiryYear.focus();
					thisPage.cancelEvent = "true";
					return false;
					}
				var contact_var;
				contact_var = document.thisForm.CreditCardName.value;
				if (contact_var.length < 1)
					{
					// if true
					newAlert("dvdorchard Credit Card Details check","Please enter the name on your credit card (not your banks name - your name).",1,0);
					document.thisForm.CreditCardName.select();
					thisPage.cancelEvent = "true";
					return false;
					}
				}
			if (paymth == 5)
				{
				var IPPcardnumber;
				IPPcardnumber = document.thisForm.CreditCardNumber.value;

				if (!allDigits3(IPPcardnumber))
					{
					// if false
					newAlert("dvdorchard IvePrepaid Payment Details check","Please re-enter your IvePrePaid.com card/voucher number using only numbers - no spaces or other characters.",1,0);
					document.thisForm.CreditCardNumber.focus();
					thisPage.cancelEvent = "true";
					return false;
					}	
				var IPPpassword;
				IPPpassword = document.thisForm.CreditCardName.value;
				if (IPPpassword.length != 8)
					{
					// if true
					newAlert("dvdorchard IvePrepaid Payment Details check","Please re-enter your IvePrePaid.com password using only numbers - no spaces or other characters.",1,0);
					document.thisForm.CreditCardName.focus();
					thisPage.cancelEvent = "true";
					return false;
					}
				if (!allDigits3(IPPpassword))
					{
					// if false
					newAlert("dvdorchard IvePrepaid Payment Details check","Please re-enter your IvePrePaid.com password using only numbers - no spaces or other characters.",1,0);
					document.thisForm.CreditCardName.focus();
					thisPage.cancelEvent = "true";
					return false;
					}	
				}
			}
		}		
	if (obj=="btnSaveCCGM")
		{
		window.status='Processing any changes now ..... Please wait a moment';
		if(event=="onclick")
			{
			var cardtype;
			cardtype = document.thisForm.mnuCreditCardType.value;
			if (cardtype == 0)
				{
				// if true
				newAlert("GamesMarket Credit Card Details check","Please select the Credit Card type.",1,0);
				document.thisForm.mnuCreditCardType.focus();
				thisPage.cancelEvent = "true";
				return false;
				}
			var cardnumber;
			cardnumber = document.thisForm.CreditCardNumber.value;
			if (cardnumber.length < 14)
				{
				// if true
				newAlert("GamesMarket Credit Card Details check","Please enter your Credit Card number using only numbers - no spaces or other characters.",1,0);
				document.thisForm.CreditCardNumber.focus();
				thisPage.cancelEvent = "true";
				return false;
				}
			if (!allDigits3(cardnumber))
 				{
				// if false
				newAlert("GamesMarket Credit Card Details check","Please re-enter your Credit Card number using only numbers - no spaces or other characters.",1,0);
				document.thisForm.CreditCardNumber.focus();
				thisPage.cancelEvent = "true";
				return false;
				}	
			if (!LuhnCheck(cardnumber) || !validateCCNum(cardtype,cardnumber))
				{
				// if false
				newAlert("GamesMarket Credit Card Details check","The Credit Card number you have provided is invalid.  Please try again using only numbers - no spaces or other characters.",1,0);
				document.thisForm.CreditCardNumber.focus();
				thisPage.cancelEvent = "true";
				return false;
				}
			var contact_var;
			contact_var = document.thisForm.CreditCardValidNo.value;
			if (contact_var.length < 3)
				{
				// if true
				newAlert("GamesMarket Credit Card Details check","Please enter a valid 3 or 4 digit Credit Card verification/security number - click on the links for information about this number if you are unsure.",1,0);
				document.thisForm.CreditCardValidNo.focus();
				thisPage.cancelEvent = "true";
				return false;
				}
			if (!allDigits(contact_var))
 				{
				// if false
				newAlert("GamesMarket Credit Card Details check","Please re-enter a valid 3 or 4 digit Credit Card verification/security number using ONLY NUMBERS. Click on the adjacent links for information about this number if you are unsure.",1,0);
				document.thisForm.CreditCardValidNo.focus();
				thisPage.cancelEvent = "true";
				return false;
				}	
			var contact_var;
			contact_var = document.thisForm.mnuCreditCardExpiryMonth.value;
			if (contact_var == 0)
				{
				// if true
				newAlert("GamesMarket Credit Card Details check","Please select your Credit Cards expiry MONTH.",1,0);
				document.thisForm.mnuCreditCardExpiryMonth.focus();
				thisPage.cancelEvent = "true";
				return false;
				}
			var contact_var;
			contact_var = document.thisForm.mnuCreditCardExpiryYear.value;
			if (contact_var == 0)
				{
				// if true
				newAlert("GamesMarket Credit Card Details check","Please select your Credit Cards expiry YEAR.",1,0);
				document.thisForm.mnuCreditCardExpiryYear.focus();
				thisPage.cancelEvent = "true";
				return false;
				}
			var contact_var;
			contact_var = document.thisForm.CreditCardName.value;
			if (contact_var.length < 1)
				{
				// if true
				newAlert("GamesMarket Credit Card Details check","Please enter the name on your credit card (not your banks name - your name).",1,0);
				document.thisForm.CreditCardName.select();
				thisPage.cancelEvent = "true";
				return false;
				}
			}
		}		
	if (obj=="btnSaveEbayCC")
		{
		window.status='Processing changes now ..... Please wait a moment';
		if(event=="onclick")
			{
			// if true
			var contact_var;
			contact_var = document.thisForm.txtEbayUserID.value;
			if (contact_var.length < 3)
				{
				// if true
				newAlert("Personal Details check","Please tell us your eBay User ID for our use in the event we have a problem processing your credit card payment.",1,0);
				document.thisForm.txtEbayUserID.focus();
				thisPage.cancelEvent = "true";
				return false;
				}
			var accountname;
			accountname = document.thisForm.txtEmailAddress.value;
			if (accountname.length < 1)
				{
				newAlert("Personal Details check","Please enter your email address for our use in the event we have a problem processing your credit card payment..",1,0);
			    document.thisForm.txtEmailAddress.select();
				thisPage.cancelEvent = "true";
				return false;
				}
			if (accountname.length > 1 && !validEmail(document.thisForm.txtEmailAddress.value))
				{
				newAlert("Account Details check","Please re-enter your email address using a valid format!",1,0);
				document.thisForm.txtEmailAddress.focus();
				thisPage.cancelEvent = "true";
				return false;
				}
			var contact_var;
			contact_var = document.thisForm.txtPayAmount.value;
			if (contact_var.length < 2)
				{
				// if true
				newAlert("Personal Details check","Please confirm the amount you are paying in AU $.",1,0);
				document.thisForm.txtPayAmount.focus();
				thisPage.cancelEvent = "true";
				return false;
				}

			var cardtype;
			var cardnumber;
			var ccvnumber;

			cardtype = document.thisForm.mnuCreditCardType.value;
			cardnumber = document.thisForm.CreditCardNumber.value;
			ccvnumber = document.thisForm.CreditCardValidNo.value;

			if (cardtype == 0)
				{
				// if true
				newAlert("Credit Card Details check","Please select the Credit Card type.",1,0);
				document.thisForm.mnuCreditCardType.focus();
				thisPage.cancelEvent = "true";
				return false;
				}
			if (cardnumber.length < 1)
				{
				// if true
				newAlert("Credit Card Details check","Please enter your Credit Card number using only numbers - no spaces or other characters.",1,0);
				document.thisForm.CreditCardNumber.focus();
				thisPage.cancelEvent = "true";
				return false;
				}
			if (!allDigits(cardnumber))
 				{
				// if false
				newAlert("Credit Card Details check","Please re-enter your Credit Card number using only numbers - no spaces or other characters.",1,0);
				document.thisForm.CreditCardNumber.focus();
				thisPage.cancelEvent = "true";
				return false;
				}	
			if (!LuhnCheck(cardnumber) || !validateCCNum(cardtype,cardnumber))
				{
				// if false
				newAlert("Credit Card Details check","The Credit Card number you have provided is invalid.  Please try again using only numbers - no spaces or other characters.",1,0);
				document.thisForm.CreditCardNumber.focus();
				thisPage.cancelEvent = "true";
				return false;
				}
			if (!allDigits(ccvnumber) || !validateCCVLength(cardtype,ccvnumber))
				{
				// if true
				newAlert("Credit Card Details check","Please enter a valid 3 digit Credit Card Verification/security number - click on the adjacent links for information about this number if you are unsure.",1,0);
				document.thisForm.CreditCardValidNo.focus();
				thisPage.cancelEvent = "true";
				return false;
				}
			if (!validateCCV(cardtype,cardnumber,ccvnumber))
 				{
				// if false
				newAlert("Credit Card Details check","Please enter a valid 3 digit Credit Card verification/security number - this is NOT a part of your card number. Click on the adjacent links for information about this number if you are unsure.",1,0);
				document.thisForm.CreditCardValidNo.focus();
				thisPage.cancelEvent = "true";
				return false;
				}	
			var contact_var;
			contact_var = document.thisForm.mnuCreditCardExpiryMonth.value;
			if (contact_var == 0)
				{
				// if true
				newAlert("Credit Card Details check","Please select your Credit Cards expiry MONTH.",1,0);
				document.thisForm.mnuCreditCardExpiryMonth.focus();
				thisPage.cancelEvent = "true";
				return false;
				}
			var contact_var;
			contact_var = document.thisForm.mnuCreditCardExpiryYear.value;
			if (contact_var == 0)
				{
				// if true
				newAlert("Credit Card Details check","Please select your Credit Cards expiry YEAR.",1,0);
				document.thisForm.mnuCreditCardExpiryYear.focus();
				thisPage.cancelEvent = "true";
				return false;
				}
			var contact_var;
			contact_var = document.thisForm.CreditCardName.value;
			if (contact_var.length < 1)
				{
				// if true
				newAlert("Credit Card Details check","Please enter the name on your credit card (not your banks name - your name).",1,0);
				document.thisForm.CreditCardName.select();
				thisPage.cancelEvent = "true";
				return false;
				}
			}
		return true;
		}		
	}
	
function cancelordercheck()
	{
	var agree=newConfirm("dvdorchard Cancel Order Check","This action will CANCEL the entire order, providing that the order, and all items within the order, are at a status that allows cancellation.  A store credit will be provided if you have already made payment - if a refund is required a cancellation fee of $5 will apply - see our Policies page off the Help Menu for more information. Is this want you want to do ?",1,1,0)
	if (agree)
		return true;
	else
		return false;	
	}		
function cancelstatusemailcheck()
	{
	var agree=newConfirm("dvdorchard Cancel Status Email Check","This action will CANCEL all Weekly Status Emails for this order. You will need to monitor our website for updates on Stock Status, Release Dates and Price changes.  Is this want you want to do ?",1,1,0)
	if (agree)
		return true;
	else
		return false;	
	}		
function cancelitemcheck()
	{
	var agree=newConfirm("dvdorchard Cancel Order Item Check","This action will CANCEL your order for this item.  if you have already paid for the item a store credit will be provided.  if you require a refund please note that a $5 cancellation fee will apply - see our Policies page off the Help Menu for more information.  Is this want you want to do ?",1,1,0)
	if (agree)
		return true;
	else
		return false;	
	}		

var exit = true; // Set an exit variable to true
var CookieName = "AccountNumber";
var CookieString = document.cookie;
var CookieSet = CookieString.split (';');
var SetSize = CookieSet.length;
var CookiePieces;
var ReturnValue = "";
var x = 0;

function exitcheck()
  	{
	alert(exit);
  	if(exit)  //test the value of the 'exit' variable
  		{
  		for (x = 0; ((x < SetSize) && (ReturnValue == "")); x++)
  			{
	  		alert(x);
			CookiePieces = CookieSet[x].split ('=');
			alert("CookieName="+CookieName);
			alert(CookiePieces);
			if (CookiePieces[0].substring (0,1) == ' ')
				{
  				CookiePieces[0] = CookiePieces[0].substring (1, CookiePieces[0].length);
  				}
  			if (CookiePieces[0] == CookieName)
  				{
  				ReturnValue = CookiePieces[1];
  				alert("ReturnValue="+ReturnValue);
  				x = ReturnValue.length;	
				alert("lastx="+x);
				if (x == 6)  //must be a Temporary A/C Number
					{
					window.open('exitsurvey.asp',"","resizable=yes," +
					"scrollbars=yes,toolbar=yes,location=no,directories=no,status=no," +
					"menubar=no");
	  				}
 				}
			}
		}	
	}

//reloads the window if Nav4 resized
function MM_reloadPage(init) {
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function FormatMoneyJS(A,W)
	{
	var N=Math.abs(Math.round(A*100));
	var S=((N<10)?"00":((N<100)?"0":""))+N;
	S=WGcs+((A<0)?WGnc:"")+WGgroup(S.substring(0,(S.length-2)))+WGdc+S.substring((S.length-2),S.length)+((A<0&&WGnc=="(")?")":"");
	return (S.length>W)?"Over":S;
	}
	
function WGgroup(S)
	{
	return (S.length<4)?S:(WGgroup(S.substring(0,S.length-3))+WGgc+S.substring(S.length-3,S.length));
	}	

function allDigits(str)
	{
	return inValidCharSet(str,"0123456789");
	}

function allDigits2(str)
	{
	return inValidCharSet(str,",0123456789");
	}

function allDigits3(str)
	{
	return inValidCharSet(str," *0123456789");
	}

function inValidCharSet(str,charset)
	{
	var result = true;
	for (var i=0;i<str.length;i++)
		if (charset.indexOf(str.substr(i,1))<0)
		{
			result = false;
			break;
		}
	return result;
	}

function LuhnCheck(str) 
	{
	var result = true;
	var sum = 0; 
	var mul = 1; 
	var strLen = str.length;
  
	for (i = 0; i < strLen; i++) 
	{
    var digit = str.substring(strLen-i-1,strLen-i);
    var tproduct = parseInt(digit ,10)*mul;
    if (tproduct >= 10)
		sum += (tproduct % 10) + 1;
    else
		sum += tproduct;
    if (mul == 1)
		mul++;
    else
		mul--;
	}
	if ((sum % 10) != 0)
		result = false;
		return result;
	}

function GetRadioValue(rArray)
	{
	for (var i=0;i<rArray.length;i++)
	{
	if (rArray[i].checked)
		return rArray[i].value;
	}
	return null;
	}

function validateCCNum(cardtype,cardNum)
	{
	var result = false;
	var cardLen = cardNum.length;
	var firstdig = cardNum.substring(0,1);
	var seconddig = cardNum.substring(1,2);
	var first4digs = cardNum.substring(0,4);

	switch (cardtype)
		{
		case "1":
			result = ((cardLen == 16) || (cardLen == 13)) && (firstdig == "4");
			break;
		case "2":
			var validNums = "12345";
			result = (cardLen == 16) && (firstdig == "5") && (validNums.indexOf(seconddig)>=0);
			break;
		case "3":
			var validNums = "47";
			result = (cardLen == 15) && (firstdig == "3") && (validNums.indexOf(seconddig)>=0);
			break;
		case "4":
			var validNums = "068";
			result = (cardLen == 14) && (firstdig == "3") && (validNums.indexOf(seconddig)>=0);
			break;
		case "5":
			var validNums = "6";
			result = (cardLen == 16) && (firstdig == "5") && (validNums.indexOf(seconddig)>=0);
			break;
		}
	return result;
	}

function validateCCVLength(cardtype,CCVNum)
	{
	var result = false;
	var CCVLen = CCVNum.length;

	switch (cardtype)
		{
		case "1":
			result = (CCVLen == 3);
			break;
		case "2":
			result = (CCVLen == 3);
			break;
		case "3":
			result = (CCVLen == 4);
			break;
		case "4":
			result = (CCVLen == 3);
			break;
		}
	return result;
	}

function validateCCV(cardtype,cardNum,CCVNum)
	{
	var result = false;

	switch (cardtype)
		{
		case "1":
			var last3digs = cardNum.substr(13,3);
			result = (last3digs != CCVNum);
			break;
		case "2":
			var last3digs = cardNum.substr(13,3);
			result = (last3digs != CCVNum);
		case "3":
			var last4digs = cardNum.substr(11,4);
			result = (last4digs != CCVNum);
		case "4":
			var last3digs = cardNum.substr(11,3);
			result = (last3digs != CCVNum);
		}
	return result;
	}

// Checking format of an e-mail entry
function validEmail(email) {
	var invalidChars, badChar, atPos, periodPos;
	var i;
	invalidChars = " /:,;";
	if (email == ""){
		return false;
	}
	for (i=0; i<invalidChars.length; i++){
		badChar = invalidChars.charAt(i);
		if (email.indexOf(badChar,0) != -1){
			return false;
		}
	}
	atPos = email.indexOf("@",1);
	if (atPos == -1){
		return false;
	}
	if (email.indexOf("@",atPos+1) != -1){
		return false;
	}
	periodPos = email.indexOf(".",atPos);
	if (periodPos == -1){
		return false;
	}
	if (periodPos+3 > email.length){
		return false;
	}
	return true;
	}
	// Format Money Value
	var WGdc=".";  var WGgc=",";  var WGnc="(";  var WGcs="$";

// GAMESMARKET SCRIPTS
	
CSStopExecution = false;
CSInit = new Array;

function CSScriptInit() 
{
idxArray = new Array;
for(var i=0;i<CSInit.length;i++)
	idxArray[i] = i;
CSAction2(CSInit, idxArray);
}

function CSClickReturn () 
{
	return true;
}

CSAg = window.navigator.userAgent; CSBVers = parseInt(CSAg.charAt(CSAg.indexOf("/")+1),10);

function IsIE() { return CSAg.indexOf("MSIE") > 0;}

function CSIEStyl(s) { return document.all.tags("div")[s].style; }

function CSNSStyl(s) { return CSFindElement(s,0); }

function CSFindElement(n,ly) { if (CSBVers < 4) return document[n];
	var curDoc = ly ? ly.document : document; var elem = curDoc[n];
	if (!elem) { for (var i=0;i<curDoc.layers.length;i++) {
		elem = CSFindElement(n,curDoc.layers[i]); if (elem) return elem; }}
	return elem;
}

function CSButtonReturn () 
{
	var bAgent = window.navigator.userAgent; 
	var bAppName = window.navigator.appName;
	if ((bAppName.indexOf("Explorer") >= 0) && (bAgent.indexOf("Mozilla/3") >= 0) && (bAgent.indexOf("Mac") >= 0))
		return false; // follow link
	else return true; // follow link
}
CSIm = new Object();

function CSIShow(n,i) {
	if (document.images) {
		if (CSIm[n]) {
			var img = (!IsIE()) ? CSFindElement(n,0) : document[n];
			if (img && typeof(CSIm[n][i].src) != "undefined") {img.src = CSIm[n][i].src;}
			if(i != 0)
				self.status = CSIm[n][3];
			else
				self.status = " ";
			return true;
		}
	}
	return false;
}

function CSILoad(action) 
{
	im = action[1];
	if (document.images) {
		CSIm[im] = new Object();
		for (var i=2;i<5;i++) {
			if (action[i] != '') { CSIm[im][i-2] = new Image(); CSIm[im][i-2].src = action[i]; }
			else CSIm[im][i-2] = 0;
		}
		CSIm[im][3] = action[5];
	}
}
CSStopExecution = false;

function CSAction(array) 
{ 
	return CSAction2(CSAct, array);
}

function CSAction2(fct, array) { 
	var result;
	for (var i=0;i<array.length;i++) {
		if(CSStopExecution) return false; 
		var actArray = fct[array[i]];
		var tempArray = new Array;
		for(var j=1;j<actArray.length;j++) {
			if((actArray[j] != null) && (typeof(actArray[j]) == "object") && (actArray[j].length == 2)) {
				if(actArray[j][0] == "VAR") {
					tempArray[j] = CSStateArray[actArray[j][1]];
				}
				else {
					if(actArray[j][0] == "ACT") {
						tempArray[j] = CSAction(new Array(new String(actArray[j][1])));
					}
				else
					tempArray[j] = actArray[j];
				}
			}
			else
				tempArray[j] = actArray[j];
		}			
		result = actArray[0](tempArray);
	}
	return result;
}
CSAct = new Object;

function CSOpenWindow(action) {
	var wf = "";	
	wf = wf + "width=" + action[3];
	wf = wf + ",height=" + action[4];
	wf = wf + ",resizable=" + (action[5] ? "yes" : "no");
	wf = wf + ",scrollbars=" + (action[6] ? "yes" : "no");
	wf = wf + ",menubar=" + (action[7] ? "yes" : "no");
	wf = wf + ",toolbar=" + (action[8] ? "yes" : "no");
	wf = wf + ",directories=" + (action[9] ? "yes" : "no");
	wf = wf + ",location=" + (action[10] ? "yes" : "no");
	wf = wf + ",status=" + (action[11] ? "yes" : "no");
	wf = wf + ",top=" + action[12];
	wf = wf + ",left=" + action[13];
	window.open(action[1],action[2],wf);
}// CMP USES JSCRIPT

// Actions
CSAct[/*CMP*/ 'BackImage'] = new Array(CSOpenWindow,/*URL*/ 'backimage.cfm','BackImage',640,480,true,true,false,false,false,false,false,10,10);

/* Text and/or Image Crawler Script ©2009 John Davenport Scheuer
   as first seen in http://www.dynamicdrive.com/forums/
   username: jscheuer1 - This Notice Must Remain for Legal Use
   */

///////////////// DO NOT EDIT /////////////////

function marqueeInit(config)
{
 if(!document.createElement) return;
 marqueeInit.ar.push(config);
 marqueeInit.run(config.uniqueid);
}

(function(){

 if(!document.createElement) return;

 marqueeInit.ar = [];

 document.write('<style type="text/css">.marquee{white-space:nowrap;overflow:hidden;visibility:hidden;}' +
 '#marq_kill_marg_bord{border:none!important;margin:0!important;}<\/style>');
 var c = 0, tTRE = [new RegExp('^\\s*$'), new RegExp('^\\s*'), new RegExp('\\s*$')],
 req1 = {'position': 'relative', 'overflow': 'hidden'}, defaultconfig = {
  style: { //default style object for marquee containers without configured style
	'margin': '0 auto'
  },
  direction: 'left',
  inc: 2, //default speed - pixel increment for each iteration of a marquee's movement
  mouse: 'pause' //default mouseover behavior ('pause' 'cursor driven' or false)
 }, dash, ie = false, oldie = 0, ie5 = false, iever = 0;
 
 /*@cc_on @*/
 /*@if(@_jscript_version >= 5)
 ie = true;
 try{document.documentMode = 2000}catch(e){};
 iever = Math.min(document.documentMode, navigator.appVersion.replace(/^.*MSIE (\d+\.\d+).*$/, '$1'));
 if(iever < 6)
  oldie = 1;
 if(iever < 5.5){
  Array.prototype.push = function(el){this[this.length] = el;};
  ie5 = true;
  dash = new RegExp('(-(.))');
  String.prototype.encamel = function(s, m){
   s = this;
   while((m = s.match(dash)))
    s = s.replace(m[1], m[2].toUpperCase());
   return s;
  };
 }
 @end @*/

 if(!ie5){
  dash = new RegExp('-(.)', 'g');
  function toHump(a, b){return b.toUpperCase();};
  String.prototype.encamel = function(){return this.replace(dash, toHump);};
 }

 if(ie && iever < 8){
  marqueeInit.table = [];
  window.attachEvent('onload', function(){
   marqueeInit.OK = true;
   for(var i = 0; i < marqueeInit.table.length; ++i)
   marqueeInit.run(marqueeInit.table[i]);
  });
 }
 
 function intable(el){
  while((el = el.parentNode))
   if(el.tagName && el.tagName.toLowerCase() === 'table')
    return true;
   return false;
 };

 marqueeInit.run = function(id){
   if(ie && !marqueeInit.OK && iever < 8 && intable(document.getElementById(id))){
    marqueeInit.table.push(id);
    return;
   }
   if(!document.getElementById(id))
    setTimeout(function(){marqueeInit.run(id);}, 300);
   else
    new Marq(c++, document.getElementById(id));
 }

 function trimTags(tag){
  var r = [], i = 0, e;
  while((e = tag.firstChild) && e.nodeType == 3 && tTRE[0].test(e.nodeValue))
   tag.removeChild(e);
  while((e = tag.lastChild) && e.nodeType == 3 && tTRE[0].test(e.nodeValue))
   tag.removeChild(e);
  if((e = tag.firstChild) && e.nodeType == 3)
   e.nodeValue = e.nodeValue.replace(tTRE[1], '');
  if((e = tag.lastChild) && e.nodeType == 3)
   e.nodeValue = e.nodeValue.replace(tTRE[2], '');
  while((e = tag.firstChild))
   r[i++] = tag.removeChild(e);
  return r;
 }

 function Marq(c, tag){
  var p, u, s, a, ims, ic, i, marqContent, cObj = this;
  this.mq = marqueeInit.ar[c];
  for (p in defaultconfig)
   if((this.mq.hasOwnProperty && !this.mq.hasOwnProperty(p)) || (!this.mq.hasOwnProperty && !this.mq[p]))
    this.mq[p] = defaultconfig[p];
  this.mq.style.width = !this.mq.style.width || isNaN(parseInt(this.mq.style.width))? '100%' : this.mq.style.width;
  if(!tag.getElementsByTagName('img')[0])
   this.mq.style.height = !this.mq.style.height || isNaN(parseInt(this.mq.style.height))? tag.offsetHeight + 3 + 'px' : this.mq.style.height;
  else
   this.mq.style.height = !this.mq.style.height || isNaN(parseInt(this.mq.style.height))? 'auto' : this.mq.style.height;
  u = this.mq.style.width.split(/\d/);
  this.cw = this.mq.style.width? [parseInt(this.mq.style.width), u[u.length - 1]] : ['a'];
  marqContent = trimTags(tag);
  tag.className = tag.id = '';
  tag.removeAttribute('class', 0);
  tag.removeAttribute('id', 0);
  if(ie)
   tag.removeAttribute('className', 0);
  tag.appendChild(tag.cloneNode(false));
  tag.className = ['marquee', c].join('');
  tag.style.overflow = 'hidden';
  this.c = tag.firstChild;
  this.c.appendChild(this.c.cloneNode(false));
  this.c.style.visibility = 'hidden';
  a = [[req1, this.c.style], [this.mq.style, this.c.style]];
  for (i = a.length - 1; i > -1; --i)
   for (p in a[i][0])
    if((a[i][0].hasOwnProperty && a[i][0].hasOwnProperty(p)) || (!a[i][0].hasOwnProperty))
     a[i][1][p.encamel()] = a[i][0][p];
  this.m = this.c.firstChild;
  if(this.mq.mouse == 'pause'){
   this.c.onmouseover = function(){cObj.mq.stopped = true;};
   this.c.onmouseout = function(){cObj.mq.stopped = false;};
  }
  this.m.style.position = 'absolute';
  this.m.style.left = '-10000000px';
  this.m.style.whiteSpace = 'nowrap';
  if(ie5) this.c.firstChild.appendChild((this.m = document.createElement('nobr')));
  if(!this.mq.noAddedSpace)
   this.m.appendChild(document.createTextNode('\xa0'));
  for(i = 0; marqContent[i]; ++i)
   this.m.appendChild(marqContent[i]);
  if(ie5) this.m = this.c.firstChild;
  ims = this.m.getElementsByTagName('img');
  if(ims.length){
   for(ic = 0, i = 0; i < ims.length; ++i){
    ims[i].style.display = 'inline';
    ims[i].style.verticalAlign = ims[i].style.verticalAlign || 'top';
    if(typeof ims[i].complete == 'boolean' && ims[i].complete && !window.opera)
     ic++;
    else {
     ims[i].onload = function(){
       if(++ic == ims.length)
        cObj.setup();
      };
    }
     if(ic == ims.length)
      this.setup();
   }
  }
   else this.setup()
 }

  Marq.prototype.setup = function(){
  if(this.mq.setup) return;
  this.mq.setup = this;
  var s, cObj = this;
  if(this.c.style.height === 'auto')
   this.c.style.height = this.m.offsetHeight + 4 + 'px';
  this.c.appendChild(this.m.cloneNode(true));
  this.m = [this.m, this.m.nextSibling];
  if(this.mq.mouse == 'cursor driven'){
   this.r = this.mq.neutral || 16;
   this.sinc = this.mq.inc;
   this.c.onmousemove = function(e){cObj.mq.stopped = false; cObj.directspeed(e)};
   if(this.mq.moveatleast){
    this.mq.inc = this.mq.moveatleast;
    if(this.mq.savedirection){
     if(this.mq.savedirection == 'reverse'){
      this.c.onmouseout = function(e){
       if(cObj.contains(e)) return;
       cObj.mq.inc = cObj.mq.moveatleast;
       cObj.mq.direction = cObj.mq.direction == 'right'? 'left' : 'right';};     
     } else {
      this.mq.savedirection = this.mq.direction;
      this.c.onmouseout = function(e){
       if(cObj.contains(e)) return;
       cObj.mq.inc = cObj.mq.moveatleast;
       cObj.mq.direction = cObj.mq.savedirection;};     
    }
    } else
     this.c.onmouseout = function(e){if(!cObj.contains(e)) cObj.mq.inc = cObj.mq.moveatleast;};
   }
   else
    this.c.onmouseout = function(e){if(!cObj.contains(e)) cObj.slowdeath();};
  }
  this.w = this.m[0].offsetWidth;
  this.m[0].style.left = 0;
  this.c.id = 'marq_kill_marg_bord';
  this.m[0].style.top = this.m[1].style.top = Math.floor((this.c.offsetHeight - this.m[0].offsetHeight) / 2 - oldie) + 'px';
  this.c.id = '';
  this.c.removeAttribute('id', 0);
  this.m[1].style.left = this.w + 'px';
  s = this.mq.moveatleast? Math.max(this.mq.moveatleast, this.sinc) : (this.sinc || this.mq.inc);
  while(this.c.offsetWidth > this.w - s)
   this.c.style.width = isNaN(this.cw[0])? this.w - s + 'px' : --this.cw[0] + this.cw[1];
  this.c.style.visibility = 'visible';
  this.runit();
  }
  
 Marq.prototype.slowdeath = function(){
  var cObj = this;
  if(this.mq.inc){
   this.mq.inc -= 1;
   this.timer = setTimeout(function(){cObj.slowdeath();}, 100);
  }
 }

 Marq.prototype.runit = function(){
  var cObj = this, d = this.mq.direction == 'right'? 1 : -1;
  if(this.mq.stopped || this.mq.stopMarquee){
   setTimeout(function(){cObj.runit();}, 300);
   return;
  }
  if(this.mq.mouse != 'cursor driven')
   this.mq.inc = Math.max(1, this.mq.inc);
  if(d * parseInt(this.m[0].style.left) >= this.w)
   this.m[0].style.left = parseInt(this.m[1].style.left) - d * this.w + 'px';
  if(d * parseInt(this.m[1].style.left) >= this.w)
   this.m[1].style.left = parseInt(this.m[0].style.left) - d * this.w + 'px';
  this.m[0].style.left = parseInt(this.m[0].style.left) + d * this.mq.inc + 'px';
  this.m[1].style.left = parseInt(this.m[1].style.left) + d * this.mq.inc + 'px';
  setTimeout(function(){cObj.runit();}, 30 + (this.mq.addDelay || 0));
 }

 Marq.prototype.directspeed = function(e){
  e = e || window.event;
  if(this.timer) clearTimeout(this.timer);
  var c = this.c, w = c.offsetWidth, l = c.offsetLeft, mp = (typeof e.pageX == 'number'?
   e.pageX : e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft) - l,
  lb = (w - this.r) / 2, rb = (w + this.r) / 2;
  while((c = c.offsetParent)) mp -= c.offsetLeft;
  this.mq.direction = mp > rb? 'left' : 'right';
  this.mq.inc = Math.round((mp > rb? (mp - rb) : mp < lb? (lb - mp) : 0) / lb * this.sinc);
 }

 Marq.prototype.contains = function(e){
  if(e && e.relatedTarget){var c = e.relatedTarget; if(c == this.c) return true;
   while ((c = c.parentNode)) if(c == this.c) return true;}
  return false;
 }

 function resize(){
  for(var s, m, i = 0; i < marqueeInit.ar.length; ++i){
   if(marqueeInit.ar[i] && marqueeInit.ar[i].setup){
    m = marqueeInit.ar[i].setup;
    s = m.mq.moveatleast? Math.max(m.mq.moveatleast, m.sinc) : (m.sinc || m.mq.inc);
    m.c.style.width = m.mq.style.width;
    m.cw[0] = m.cw.length > 1? parseInt(m.mq.style.width) : 'a';
    while(m.c.offsetWidth > m.w - s)
     m.c.style.width = isNaN(m.cw[0])? m.w - s + 'px' : --m.cw[0] + m.cw[1];
   }
  }
 }

 if (window.addEventListener)
  window.addEventListener('resize', resize, false);
 else if (window.attachEvent)
  window.attachEvent('onresize', resize);

})();	
	



