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.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_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];}
}

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_jumpMenu(targ,selObj,restore){ //v3.0
  	eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  	if (restore) selObj.selectedIndex=0;
}

//Redemption: View Item.
function newWindow(images){
	var picWindow
	picWindow = window.open("",'picWin', 'width=360,height=380')
	picWindow.document.write("<img src='" + images + "'><br><br>");
	picWindow.document.write("<body bgcolor=#000066><a href=# onClick='window.close()'><center><img src=images/redemption/close.gif border=0></center></a></body>")
	picWindow.focus()
}

//Main: Game Demo
function popupWindow(url){
  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=800,height=550,screenX=120,screenY=120,top=120,left=120')
}

function writeCopyright(){
	document.write("&copy; 2005-2008 Croftminster Pty. Ltd. All Rights Reserved.");
}



/***************** 
 * ADMIN SECTION *
 *****************/

//Admin: Products
function toggleOtherName(selected){
	var webAddress = document.Create_Product.txtSupplierWebPage;
	
	if (selected == 'other'){
		document.Create_Product.otherName.style.visibility = 'visible';
		document.Create_Product.otherName.value = '<Enter supplier name>';
		document.Create_Product.otherWeb.style.visibility = 'visible';
		document.Create_Product.otherWeb.value = '<Enter supplier web page>';
		webAddress.value = 'other';
		document.Create_Product.txtSupplierWebPage.disabled = 'true';}
	else{
		document.Create_Product.otherName.style.visibility = 'hidden';
		document.Create_Product.otherName.value = '';
		document.Create_Product.otherWeb.style.visibility = 'hidden';
		document.Create_Product.otherWeb.value = '';
	
		if (selected == '4Kids Entertainment'){
			webAddress.value = 'www.4kidsentertainment.com';}
		else if (selected == 'Action Figure Xpress'){
			webAddress.value = 'www.shopafx.com';}
		else if (selected == 'Bandai'){
			webAddress.value = 'www.bandai.com';}
		else if (selected == 'California Creations'){
			webAddress.value = 'www.californiacreations.net';}
		else if (selected == 'Cinemaquette'){
			webAddress.value = 'www.cinemaquette.com';}
		else if (selected == 'Dark Horse'){
			webAddress.value = 'www.darkhorse.com';}
		else if (selected == 'DC Comics'){
			webAddress.value = 'www.dccomics.com';}
		else if (selected == 'Diamond Select'){
			webAddress.value = 'www.diamondcomics.com';}
		else if (selected == 'First 4 Figures'){
			webAddress.value = 'www.first4figures.com';}
		else if (selected == 'Gentle Giant Ltd'){
			webAddress.value = 'www.gentlegiantltd.com';}
		else if (selected == 'Hidden City Games'){
			webAddress.value = 'www.hiddencitygames.com';}
		else if (selected == 'Inkworks'){
			webAddress.value = 'www.inkworkscards.com';}
		else if (selected == 'JUN Planning Co'){
			webAddress.value = 'www.junplanning.co.jp';}
		else if (selected == 'Kotobukiya'){
			webAddress.value = 'www.kotobukiya.co.jp';}
		else if (selected == 'Locoape'){
			webAddress.value = 'www.locoape.com';}
		else if (selected == 'MasterPieces'){
			webAddress.value = 'www.masterpiecesinc.com';}
		else if (selected == 'Open Mind - Numberjacks'){
			webAddress.value = 'www.openmind.co.uk/numberjacks';}
		else if (selected == 'Organic'){
			webAddress.value = 'www.organic-f.net';}
		else if (selected == 'Pokemon USA'){
			webAddress.value = 'www.go-pokemon.com';}
		else if (selected == 'Square Enix'){
			webAddress.value = 'www.square-enix.com';}
		else if (selected == 'Topps'){
			webAddress.value = 'www.topps.com';}
		else if (selected == 'Toynami'){
			webAddress.value = 'www.toynami.com';}
		else if (selected == 'UltraPro'){
			webAddress.value = 'www.ultra-pro.com';}
		else if (selected == 'Upperdeck'){
			webAddress.value = 'www.upperdeckentertainment.com';}
		else if (selected == 'VooDooBaby'){
			webAddress.value = 'www.vdbaby.com';}
		else if (selected == 'Weta Collectibles'){
			webAddress.value = 'www.wetacollectibles.co.nz';}
		else if (selected == 'Wizards of the Coast'){
			webAddress.value = 'www.wizards.com';}
		else if (selected == 'WizKids Games'){
			webAddress.value = 'www.wizkidsgames.com';}
		else if (selected == 'Yamato'){
			webAddress.value = 'www.yamatotoysusa.com';}
	}
}
/**function toggleOtherWeb(selected){
	if (selected == 'other'){
		document.Create_Product.otherWeb.style.visibility = 'visible';}
	else{
		document.Create_Product.otherWeb.style.visibility = 'hidden';
		document.Create_Product.otherWeb.value = '';}
}**/

function validateProduct() {
	valYear=document.Create_Product.year.value;
	valMonth=document.Create_Product.month.value;
	valDay=document.Create_Product.day.value;
	
	if (valYear=='') {
		alert('Please enter in the Year of availability.');
		return false;
	}
	
	if (valMonth=='') {
		alert('Please enter in the Month of availability.');
		return false;
	}
	else{
		if (valMonth=='02'){
			if (valDay=='30' || valDay=='31'){
				alert('The date is incorrect. Please try again.');
				return false;
			}
		}
	
		if (valMonth=='04' || valMonth=='06' || valMonth=='09' || valMonth=='11'){
			if (valDay=='31'){
				alert('The date is incorrect. Please try again.');
				return false;
			}
		}
	}
}
	
//Admin: Pokemon Event
function validateEvent() {
	valTournamentName=document.Create_Pokemon_Event.txtTournamentName.value;
	valTournamentID=document.Create_Pokemon_Event.txtTournamentID.value;
	valLocationName=document.Create_Pokemon_Event.txtLocationName.value;
	valAddress=document.Create_Pokemon_Event.txtAddress.value;
	valSuburb=document.Create_Pokemon_Event.txtSuburb.value;
	valState=document.Create_Pokemon_Event.txtState.value;
	valPostCode=document.Create_Pokemon_Event.txtPostCode.value;
	valCountry=document.Create_Pokemon_Event.txtCountry.value;
	valTime=document.Create_Pokemon_Event.txtTime.value;
	valMoreDetailUrl=document.Create_Pokemon_Event.txtMoreDetailUrl.value;
	
	valYear=document.Create_Pokemon_Event.year.value;
	valMonth=document.Create_Pokemon_Event.month.value;
	valDay=document.Create_Pokemon_Event.day.value;
	
	if (valTournamentName=='' || valTournamentID=='' || valLocationName=='' 
		|| valAddress=='' || valSuburb=='' || valState=='' 
		|| valPostCode=='' || valCountry=='' || valTime==''
		|| valMoreDetailUrl=='' || valYear=='' || valMonth=='' || valDay=='') {
		alert('All fields must be filled out.');
		return false;
	}
	
	if (valMonth=='02'){
		if (valDay=='30' || valDay=='31'){
			alert('The date is incorrect. Please try again.');
			return false;
		}
	}
	else if (valMonth=='04' || valMonth=='06' || valMonth=='09' || valMonth=='11'){
		if (valDay=='31'){
			alert('The date is incorrect. Please try again.');
			return false;
		}
	}
}

//Admin: Pokemon Strategy
function validateStrategy() {
	valArticleTitle=document.Create_Pokemon_Strategy.txtArticleTitle.value;
	valArticleDesc=document.Create_Pokemon_Strategy.txtArticleDesc.value;
	valAuthor=document.Create_Pokemon_Strategy.txtAuthor.value;
	valYear=document.Create_Pokemon_Strategy.year.value;
	valMonth=document.Create_Pokemon_Strategy.month.value;
	valDay=document.Create_Pokemon_Strategy.day.value;
	
	if (valArticleTitle=='' || valArticleDesc=='' || valAuthor=='' || valYear=='' || valMonth=='') {
		alert('All fields must be filled out.');
		return false;
	}
	
	if (valMonth=='02'){
		if (valDay=='30' || valDay=='31'){
			alert('The date is incorrect. Please try again.');
			return false;
		}
	}
	else if (valMonth=='04' || valMonth=='06' || valMonth=='09' || valMonth=='11'){
		if (valDay=='31'){
			alert('The date is incorrect. Please try again.');
			return false;
		}
	}
}