<!--
// Global Variables
var useStandards=(document.getElementById);
var NS6=(document.getElementbyId && !document.all);
var IE=(document.all);
var NS=(navigator.appName=="Netscape" && navigator.appVersion.charAt(0)=='4');
var preloadFlag = false;
var  noIm=1; 
//----------------------------------------------------------------------------------
function move_up(value){
	document.location = 'sort_order.php?action=up&category_id=' + value;
}
//----------------------------------------------------------------------------------
function move_down(value){
	document.location = 'sort_order.php?action=down&category_id=' + value;
}
//----------------------------------------------------------------------------------
function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}
function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}
var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		home_over = newImage("images/home_over.gif");
		category_over = newImage("images/category_over.gif");
		shopping_over = newImage("images/shopping_over.gif");
		contact_over = newImage("images/contact_over.gif");
		faq_over = newImage("images/faq_over.gif");
		login_over = newImage("images/login_over.gif");
		preloadFlag = true;
	}
}
//----------------------------------------------------------------------------------
function picturePopup(){
	popupwindow=window.open("picture.php","Picture","menubar=no,width=780,height=450,toolbar=no,scrollbars=yes,status=no");
	if (window.focus) {popupwindow.focus()}
}
//----------------------------------------------------------------------------------
function returnPicture(data){
	window.opener.document.f1.picture.value=data;
	window.close();
}
//----------------------------------------------------------------------------------
function addSize(value){
	popupwindow=window.open("addsize.php?type_id="+value,"Size","menubar=no,width=400,height=40,toolbar=no,scrollbar=no");
	if (window.focus) {popupwindow.focus()}
}
//----------------------------------------------------------------------------------
function characterPopup(value){
	popupwindow=window.open("character.php?no="+value,"character","menubar=no,width=780,height=450,toolbar=no,scrollbars=yes,status=no");
	if (window.focus) {popupwindow.focus()}
}
//----------------------------------------------------------------------------------
function returncharacter(data,data2){
	var tcharacter="character"+data;
	window.opener.document.f1[tcharacter].value=data2;
	window.close();
}
//----------------------------------------------------------------------------------
	var test = new Array();
	test[0]='message';
	test[1]='picture';
	test[2]='name';
	test[3]='address';
	test[4]='character1';
	test[5]='character1_name';
	test[6]='grade_or_year_text';
function checkData() {
	for(var i=0; i<=test.length; i++){
		if(document.getElementById(test[i])){
			if(document.getElementById(test[i]).value.length<1){
				ChangeColor()
				alert("Please complete all fields in red");
				return false;
				exit;
			}	
		}	
	}
}
//----------------------------------------------------------------------------------
function ChangeColor() {
	for(var i=0; i<=test.length; i++){
		if(document.getElementById(test[i])){
			if(document.getElementById(test[i]).value.length<1){
				document.getElementById(test[i]).style.background="#ff9999"
			}else{
				document.getElementById(test[i]).style.background="#ffffff"
			}	
		}
	}
}
//-----------------------------------------------------------------------------------
var testR = new Array();
	testR[0]='firstname';
	testR[1]='lastname';
	testR[2]='cell';
	testR[3]='username';
	testR[4]='username2';
	testR[5]='password';
	testR[6]='password2';
function checkRegister() {
	var str=document.getElementById('username').value
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	for(var i=0; i<=testR.length; i++){
		if(document.getElementById(testR[i])){
			if(document.getElementById(testR[i]).value.length<1){
				ChangeColor2()
				alert("Please complete all fields in red");
				return false;
			}
			if (str.indexOf(at)==-1){
				ChangeColor2()
				document.getElementById('username').style.background = "#ff9999";	
				alert("Invalid E-mail Address")
				return false
			}
			if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
				ChangeColor2()
				document.getElementById('username').style.background = "#ff9999";	
				alert("Invalid E-mail Address")
				return false
			}
			if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
				ChangeColor2()
				document.getElementById('username').style.background = "#ff9999";	
				alert("Invalid E-mail Address")
				return false
			}
			if (str.indexOf(at,(lat+1))!=-1){
				ChangeColor2()
				document.getElementById('username').style.background = "#ff9999";	
				alert("Invalid E-mail Address")
				return false
			}
			if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
				ChangeColor2()
				document.getElementById('username').style.background = "#ff9999";	
				alert("Invalid E-mail Address")
				return false
			}
			if (str.indexOf(dot,(lat+2))==-1){	
				ChangeColor2()
				document.getElementById('username').style.background = "#ff9999";
				alert("Invalid E-mail Address")
				return false
			}
			 if (str.indexOf(" ")!=-1){	
				ChangeColor2()
				document.getElementById('username').style.background = "#ff9999";
				alert("Invalid E-mail Address")
				return false
			}
			if (document.getElementById('username').value!=document.getElementById('username2').value){
				ChangeColor2()
				document.getElementById('username').style.background = "#ff9999";	
				document.getElementById('username2').style.background = "#ff9999";	
				alert("Your Email addresses dont match.");
				return false;
			}
			if (document.getElementById('password').value!=document.getElementById('password2').value){
				ChangeColor2()
				document.getElementById('password').style.background = "#ff9999";	
				document.getElementById('password2').style.background = "#ff9999";	
				alert("Your Passwords dont match");
				return false;
			}
		}	
	}
}
//----------------------------------------------------------------------------------
function ChangeColor2() {
	for(var i=0; i<=testR.length; i++){
		if(document.getElementById(testR[i])){
			if(document.getElementById(testR[i]).value.length<1){
				document.getElementById(testR[i]).style.background="#ff9999"
			}else{
				document.getElementById(testR[i]).style.background="#ffffff"
			}	
		}
	}
}
//-----------------------------------------------------------------------------------
function setPaymentInfo(isChecked){
	with (window.document.frmCheckout) {
		if (isChecked) {
			payment_first_name.value = shipping_first_name.value;
			payment_last_name.value = shipping_last_name.value;
			payment_address1.value = shipping_address1.value;
			payment_address2.value = shipping_address2.value;
			payment_phone.value = shipping_phone.value;
			payment_province.value = shipping_province.value;			
			payment_city.value = shipping_city.value;
			payment_postal_code.value = shipping_postal_code.value;
			payment_first_name.readOnly = true;
			payment_last_name.readOnly = true;
			payment_address1.readOnly = true;
			payment_address2.readOnly = true;
			payment_phone.readOnly = true;
			payment_province.readOnly = true;			
			payment_city.readOnly = true;
			payment_postal_code.readOnly = true;			
		} else {
			payment_first_name.readOnly = false;
			payment_last_name.readOnly = false;
			payment_address1.readOnly = false;
			payment_address2.readOnly = false;
			payment_phone.readOnly = false;
			payment_province.readOnly = false;			
			payment_city.readOnly = false;
			payment_postal_code.readOnly = false;			
		}
	}
}
//-----------------------------------------------------------------------------------
var testR = new Array();
	testR[0]='email';
	testR[1]='cell';
function checkPassword() {
	var str=document.getElementById('email').value
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	for(var i=0; i<=testR.length; i++){
		if(document.getElementById(testR[i])){
			if(document.getElementById(testR[i]).value.length<1){
				ChangeColor2()
				alert("Please complete all fields in red");
				return false;
			}
			if (str.indexOf(at)==-1){
				ChangeColor2()
				document.getElementById('email').style.background = "#ff9999";	
				alert("Invalid E-mail Address")
				return false
			}
			if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
				ChangeColor2()
				document.getElementById('email').style.background = "#ff9999";	
				alert("Invalid E-mail Address")
				return false
			}
			if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
				ChangeColor2()
				document.getElementById('email').style.background = "#ff9999";	
				alert("Invalid E-mail Address")
				return false
			}
			if (str.indexOf(at,(lat+1))!=-1){
				ChangeColor2()
				document.getElementById('email').style.background = "#ff9999";	
				alert("Invalid E-mail Address")
				return false
			}
			if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
				ChangeColor2()
				document.getElementById('email').style.background = "#ff9999";	
				alert("Invalid E-mail Address")
				return false
			}
			if (str.indexOf(dot,(lat+2))==-1){	
				ChangeColor2()
				document.getElementById('email').style.background = "#ff9999";
				alert("Invalid E-mail Address")
				return false
			}
			 if (str.indexOf(" ")!=-1){	
				ChangeColor2()
				document.getElementById('email').style.background = "#ff9999";
				alert("Invalid E-mail Address")
				return false
			}
		}	
	}
}
//----------------------------------------------------------------------------------
function tables(value){
	var x = parseInt(value)+1
		document.getElementById("size"+x).style.display = "block";
		document.getElementById("but"+value).style.display = "none";
	if (x == 10){
		document.getElementById("but"+x).style.display = "none";
	}else{
		document.getElementById("but"+x).style.display = "block";
	}
}
//----------------------------------------------------------------------------------
function hidebut(value){
	document.getElementById("but"+value).style.display = "none";
}
//----------------------------------------------------------------------------------
var testR = new Array();
	testR[0]='name';
	testR[1]='tel';
	testR[2]='cell';
	testR[3]='email';
	testR[4]='address1';
	testR[5]='address2';
	testR[6]='city';
	testR[7]='province';
	testR[8]='postal_code';
function checkDelivery_Info() {
	var str=document.getElementById('email').value
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	for(var i=0; i<=testR.length; i++){
		if(document.getElementById(testR[i])){
			if(document.getElementById(testR[i]).value.length<1){
				ChangeColor2()
				alert("Please complete all fields in red");
				return false;
			}
			if (str.indexOf(at)==-1){
				ChangeColor2()
				document.getElementById('email').style.background = "#ff9999";	
				alert("Invalid E-mail Address")
				return false
			}
			if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
				ChangeColor2()
				document.getElementById('email').style.background = "#ff9999";	
				alert("Invalid E-mail Address")
				return false
			}
			if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
				ChangeColor2()
				document.getElementById('email').style.background = "#ff9999";	
				alert("Invalid E-mail Address")
				return false
			}
			if (str.indexOf(at,(lat+1))!=-1){
				ChangeColor2()
				document.getElementById('email').style.background = "#ff9999";	
				alert("Invalid E-mail Address")
				return false
			}
			if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
				ChangeColor2()
				document.getElementById('email').style.background = "#ff9999";	
				alert("Invalid E-mail Address")
				return false
			}
			if (str.indexOf(dot,(lat+2))==-1){	
				ChangeColor2()
				document.getElementById('email').style.background = "#ff9999";
				alert("Invalid E-mail Address")
				return false
			}
			 if (str.indexOf(" ")!=-1){	
				ChangeColor2()
				document.getElementById('email').style.background = "#ff9999";
				alert("Invalid E-mail Address")
				return false
			}
		}	
	}
}
//----------------------------------------------------------------------------------