function MWJ_findObj( oName, oFrame, oDoc ) {
	if( !oDoc ) { if( oFrame ) { oDoc = oFrame.document; } else { oDoc = window.document; } }
	if( oDoc[oName] ) { return oDoc[oName]; } if( oDoc.all && oDoc.all[oName] ) { return oDoc.all[oName]; }
	if( oDoc.getElementById && oDoc.getElementById(oName) ) { return oDoc.getElementById(oName); }
	for( var x = 0; x < oDoc.forms.length; x++ ) { if( oDoc.forms[x][oName] ) { return oDoc.forms[x][oName]; } }
	for( var x = 0; x < oDoc.anchors.length; x++ ) { if( oDoc.anchors[x].name == oName ) { return oDoc.anchors[x]; } }
	for( var x = 0; document.layers && x < oDoc.layers.length; x++ ) {
		var theOb = MWJ_findObj( oName, null, oDoc.layers[x].document ); if( theOb ) { return theOb; } }
	if( !oFrame && window[oName] ) { return window[oName]; } if( oFrame && oFrame[oName] ) { return oFrame[oName]; }
	for( var x = 0; oFrame && oFrame.frames && x < oFrame.frames.length; x++ ) {
		var theOb = MWJ_findObj( oName, oFrame.frames[x], oFrame.frames[x].document ); if( theOb ) { return theOb; } }
	return null;
}

function URLDecode(myval)
{
   // Replace + with ' '
   // Replace %xx with equivalent character
   // Put [ERROR] in output if %xx is invalid.
   var HEXCHARS = "0123456789ABCDEFabcdef"; 
   var encoded = myval;
   var plaintext = "";
   var i = 0;
   while (i < encoded.length) {
       var ch = encoded.charAt(i);
	   if (ch == "+") {
	       plaintext += " ";
		   i++;
	   } else if (ch == "%") {
			if (i < (encoded.length-2) 
					&& HEXCHARS.indexOf(encoded.charAt(i+1)) != -1 
					&& HEXCHARS.indexOf(encoded.charAt(i+2)) != -1 ) {
				plaintext += unescape( encoded.substr(i,3) );
				i += 3;
			} else {
				alert( 'Bad escape combination near ...' + encoded.substr(i) );
				plaintext += "%[ERROR]";
				i++;
			}
		} else {
		   plaintext += ch;
		   i++;
		}
	} // while
   //document.URLForm.F1.value = plaintext;
   return plaintext;
};

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_validateForm() { //v4.0
  if (document.getElementById){
    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
    for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
      if (val) { nm=val.name; if ((val=val.value)!="") {
        if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
          if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
        } else if (test!='R') { num = parseFloat(val);
          if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
          if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
            min=test.substring(8,p); max=test.substring(p+1);
            if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
      } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
    } if (errors) alert('The following error(s) occurred:\n'+errors);
    document.MM_returnValue = (errors == '');
} }

function MM_validateForm2() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm2.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.title; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' You must agree to the Terms & Conditions.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}

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_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_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 gObj,gHex,timer,m1id,m2id,m3id;
function NN_tr_start(obj,hex,type){
	//window.status = obj.id;
	var isMoz = parseInt(navigator.appVersion) >= 5 && navigator.appName == 'Netscape' ? true : false;
	if (type == 'fade' && !isMoz){gHex=hex;gObj=obj;NN_tr_fadeIn();
	} else { obj.style.backgroundColor=hex;}
	obj.style.cursor='hand';
	l1 = obj.id.substring(2,1);
	if (l1 == '2')
	{
		//NN_tr_start(MWJ_findObj('m1_10'),'#89bae1','fade');
	}
	else
	{
		//NN_tr_reset(MWJ_findObj('m1_10'),'#dbdbdb');
	}
	//alert(l1);
}

function NN_tr_fadeIn_old(){
	var cntr=0,pObj=gObj.style.backgroundColor;
	var r = parseInt(gHex.substring(1,3),16),g = parseInt(gHex.substring(3,5),16), b = parseInt(gHex.substring(5,7),16);
	var rr = parseInt(pObj.substring(1,3),16),gg = parseInt(pObj.substring(3,5),16),bb = parseInt(pObj.substring(5,7),16);
		if (r!=rr){if(rr<r){rr++;}else{rr--;}}else{cntr++;}
		if (g!=gg){if(gg<g){gg++;}else{gg--;}}else{cntr++;}
		if (b!=bb){if(bb<b){bb++;}else{bb--;}}else{cntr++;}
	rr=rr.toString(16);gg=gg.toString(16);bb=bb.toString(16);
	rr=rr.length==1?'0'+rr:rr;gg=gg.length==1?'0'+gg:gg;bb=bb.length==1?'0'+bb:bb;
	gObj.style.backgroundColor='#'+rr.toUpperCase()+gg.toUpperCase()+bb.toUpperCase();
	if (cntr!=3){timer=setTimeout('NN_tr_fadeIn()',0);}
}

function NN_tr_fadeIn(){
	var cntr=0,pObj=gObj.style.backgroundColor;
	gObj.style.backgroundColor= gHex;
}

function NN_tr_reset(obj,hex){
	obj.style.backgroundColor=hex;clearTimeout(timer);
}

/*var xmlhttp

function loadXMLDoc(url)
{
xmlhttp=null
// code for Mozilla, etc.
if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest()
  }
// code for IE
else if (window.ActiveXObject)
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
  }
if (xmlhttp!=null)
  {
  xmlhttp.onreadystatechange=state_Change
  xmlhttp.open("POST",url,true)
  xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
  xmlhttp.send(null)
  }
else
  {
  alert("Your browser does not support XMLHTTP.")
  }
}

function state_Change()
{
// if xmlhttp shows "loaded"
if (xmlhttp.readyState==4)
  {
  // if "OK"
  if (xmlhttp.status==200)
  {
  //alert(xmlhttp.getResponseHeader("Content-Type"));
  //alert(xmlhttp.getAllResponseHeaders());
  document.getElementById('cs_holder').innerHTML=xmlhttp.responseText
  }
  else
  {
  alert("Problem retrieving page data:" + xmlhttp.statusText)
  }
  }
}
*/

function getAnchorPosition(anchorname) {
	// This function will return an Object with x and y properties
	var useWindow=false;
	var coordinates=new Object();
	var x=0,y=0;
	// Browser capability sniffing
	var use_gebi=false, use_css=false, use_layers=false;
	if (document.getElementById) { use_gebi=true; }
	else if (document.all) { use_css=true; }
	else if (document.layers) { use_layers=true; }
	// Logic to find position
 	if (use_gebi && document.all) {
		x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]);
		y=AnchorPosition_getPageOffsetTop(document.all[anchorname]);
		}
	else if (use_gebi) {
		var o=document.getElementById(anchorname);
		x=AnchorPosition_getPageOffsetLeft(o);
		y=AnchorPosition_getPageOffsetTop(o);
		}
 	else if (use_css) {
		x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]);
		y=AnchorPosition_getPageOffsetTop(document.all[anchorname]);
		}
	else if (use_layers) {
		var found=0;
		for (var i=0; i<document.anchors.length; i++) {
			if (document.anchors[i].name==anchorname) { found=1; break; }
			}
		if (found==0) {
			coordinates.x=0; coordinates.y=0; return coordinates;
			}
		x=document.anchors[i].x;
		y=document.anchors[i].y;
		}
	else {
		coordinates.x=0; coordinates.y=0; return coordinates;
		}
	//alert(y);
	coordinates.x=x;
	coordinates.y=y;
	return coordinates;
}

// getAnchorWindowPosition(anchorname)
//   This function returns an object having .x and .y properties which are the coordinates
//   of the named anchor, relative to the window
function getAnchorWindowPosition(anchorname) {
	var coordinates=getAnchorPosition(anchorname);
	var x=0;
	var y=0;
	if (document.getElementById) {
		if (isNaN(window.screenX)) {
			x=coordinates.x-document.body.scrollLeft+window.screenLeft;
			y=coordinates.y-document.body.scrollTop+window.screenTop;
			}
		else {
			x=coordinates.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;
			y=coordinates.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset;
			}
		}
	else if (document.all) {
		x=coordinates.x-document.body.scrollLeft+window.screenLeft;
		y=coordinates.y-document.body.scrollTop+window.screenTop;
		}
	else if (document.layers) {
		x=coordinates.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;
		y=coordinates.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset;
		}
	coordinates.x=x;
	coordinates.y=y;
	return coordinates;
	}

// Functions for IE to get position of an object
function AnchorPosition_getPageOffsetLeft (el) {
	var ol=el.offsetLeft;
	while ((el=el.offsetParent) != null) { ol += el.offsetLeft; }
	return ol;
	}
function AnchorPosition_getWindowOffsetLeft (el) {
	return AnchorPosition_getPageOffsetLeft(el)-document.body.scrollLeft;
	}	
function AnchorPosition_getPageOffsetTop (el) {
	var ot=el.offsetTop;
	while((el=el.offsetParent) != null) { ot += el.offsetTop; }
	return ot;
	}
function AnchorPosition_getWindowOffsetTop (el) {
	return AnchorPosition_getPageOffsetTop(el)-document.body.scrollTop;
	}


var pageoffset = 402;

function scrollmeFF(myid)
{
	coords = getAnchorPosition("link" + myid);
	document.getElementById('cs_scroller').scrollTop = coords.y - pageoffset;
}



function autoscroll()
{
	document.increment = document.increment + 9;
	if (document.sdiff >= 0)
	{
		document.getElementById('cs_scroller').scrollTop = document.sstart + document.increment;
		if (document.getElementById('cs_scroller').scrollTop <= document.starget)
		{
			setTimeout("autoscroll()",1);
		}
	}
	else
	{
		document.getElementById('cs_scroller').scrollTop = document.sstart - document.increment;
		if (document.getElementById('cs_scroller').scrollTop >= document.starget)
		{
			setTimeout("autoscroll()",1);
		}
	}
	
}

function imgmenu(menuItem)
{
	var src_now = menuItem.src;	
	//menunum = src_now.charAt(src_now.lastIndexOf("_") + 1);
	isOver = src_now.lastIndexOf("over");
	if (isOver == -1) {menuItem.src = '/images/menus/menu_' + menuItem.id + '_over.gif'} else {menuItem.src = '/images/menus/menu_' + menuItem.id + '.gif'};
}

function imgsubmenu(menuItem,subpage)
{
	var src_now = menuItem.src;	
	isOver = src_now.lastIndexOf("over");
	if (isOver == -1) 
	{
		menuItem.src = 'images/menus/sub_' + subpage + '_' + menuItem.id + '_over.gif';
	} 
	else 
	{
		menuItem.src = 'images/menus/sub_' + subpage + '_' + menuItem.id + '.gif';
	}
	
}

function addcat()
{
	cname = prompt('Enter the category name');
	if ((cname != 'undefined') && (cname != ''))
	{
		window.frames[0].location = 'addcat.asp?name=' + cname;
	}
	
}

function imgsubmenu2(menuItem,subpage)
{
	var src_now = menuItem.style.backgroundImage + '';
	isOver = src_now.lastIndexOf("over");
	mylink = MM_findObj(menuItem.id + '_link');
	if (isOver == -1) 
	{
		menuItem.style.backgroundImage = 'url(images/menus/shop_button_over.gif)';
		if (mylink.style) mylink.style.color = '#ffffff';
	} 
	else 
	{
		menuItem.style.backgroundImage = 'url(images/menus/shop_button.gif)';
		if (mylink.style) mylink.style.color = '#333333';
	}
	
}

function checkdetails()
{
	if (MM_findObj('pass').value != MM_findObj('pass2').value)
	{
		alert('Passwords do not match');
	}
	else
	{
		if (MM_findObj('email').value != MM_findObj('cemail').value)
		{
			alert('Email addresses do not match');
		}
		else
		{
		if (MM_findObj('tccheck').checked)
		{
			if (MM_findObj('country').selectedIndex != 0)
			{
				if (MM_findObj('hear').selectedIndex != 0)
				{
					MM_findObj('register_form').submit();
				}
				else
				{
					alert('You must say how you heard about the competition to proceed.');
				}
			}
			else
			{
				alert('You must choose a country to proceed.');
			}
		}
		else
		{
			alert('You must agree to the terms and conditions to proceed.');
		}
		}
	}
}

function forgotpass()
{
	if (MM_findObj('username').value != '')
	{
		window.frames[0].location = 'forgotpass.asp?email=' + MM_findObj('username').value;
	}
	else
	{
		alert('Please enter your registered email address to retrieve your password');
	}
}

function forgotact()
{
	if (MM_findObj('username').value != '')
	{
		window.frames[0].location = 'forgotact.asp?email=' + MM_findObj('username').value;
	}
	else
	{
		alert('Please enter your registered email address to resend your activation email');
	}
}


function ah(obj,state)
{
	//alert(obj.style.backgroundColor);
	if (state) {obj.style.backgroundColor = '#666666'} else {obj.style.backgroundColor = '#999999'}
}

function ahs(obj,state)
{
	//alert(obj.style.backgroundColor);
	if (state) {obj.style.backgroundColor = '#888888'} else {obj.style.backgroundColor = '#666666'}
}

function remnews(id)
{
	if(confirm('Are you sure you want to remove this user from the newsletter?'))
	{
		window.frames[0].location = 'remnews.asp?id=' + id
	}
}

function remvoucher(id)
{
	if(confirm('Are you sure you want to remove this voucher from the system?'))
	{
		window.frames[0].location = 'remvoucher.asp?id=' + id
	}
}

function deluser(id)
{
	if(confirm('Are you sure you want to completely remove this user from the system?\nAll images, purchases and data will be deleted.'))
	{
		window.frames[0].location = 'deluser.asp?id=' + id
	}
}

function editi(iid)
{
	window.open('editi.asp?it=1&id=' + iid,'editi');
}

function editim(iid)
{
	window.open('editim.asp?it=1&id=' + iid,'editi');
}

function editp(id)
{
	window.open('editp.asp?it=2&id=' + id,'editp');
}


function delitem(id)
{
	if(confirm('Are you sure you want to completely remove this item from the shop?'))
	{
		window.frames[0].location = 'delitem.asp?id=' + id
	}
}

function delport(id)
{
	if(confirm('Are you sure you want to completely remove this portfolio from the JUDGES AREA?\nThis portfolio may still be viewed in the ADMIN AREA'))
	{
		window.frames[0].location = 'delport.asp?id=' + id
	}
}

function delmyimage(id)
{
	if(confirm('Are you sure you want to completely remove this image?'))
	{
		window.frames[0].location = 'delsi_user.asp?id=' + id
	}
}

function delmymimage(id)
{
	if(confirm('Are you sure you want to completely remove this image?'))
	{
		window.frames[0].location = 'delsi_userm.asp?id=' + id
	}
}

function delsi(id,af)
{
	if(confirm('Are you sure you want to completely remove this image from the system?'))
	{
		window.frames[0].location = 'delsi.asp?id=' + id + "&af=" + af
	}
}

function delsijudge(id,af)
{
	if(confirm('Are you sure you want to completely remove this image from the JUDGES AREA?\nThis image may still be viewed in the ADMIN AREA'))
	{
		window.frames[0].location = 'deljudge.asp?id=' + id + "&af=" + af
	}
}

function encrypt(phrase)
{
	var encoded = "";
	for (a=0; a<=phrase.length - 1; a++)
	{
		lettercode = phrase.charCodeAt(a);
		encoded = encoded + String.fromCharCode(lettercode + 10);
	}
	return encoded;
}

function decrypt(phrase)
{
	var encoded = "";
	for (a=0; a<=phrase.length - 1; a++)
	{
		lettercode = phrase.charCodeAt(a);
		mychar = String.fromCharCode(lettercode - 10);
		if (lettercode == 92)
		{
			//alert('oh no');
			mychar = 'R'
		}
		encoded = encoded + mychar;
		//encoded = '' + a + ':' + encoded + lettercode + ' ';
	}
	return encoded;
}

var xmlhttp

function loadXMLDoc(url)
{
xmlhttp=null
// code for Mozilla, etc.
if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest()
  }
// code for IE
else if (window.ActiveXObject)
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
  }
if (xmlhttp!=null)
  {
  xmlhttp.onreadystatechange=state_Change
  xmlhttp.open("GET",url,true)
  // using get in this instance as firefox is being weird!
  //xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
  //xmlhttp.setRequestHeader('Content-length', '0');
  xmlhttp.send(null)
  }
else
  {
  alert("Your browser does not support XMLHTTP.")
  }
}

function state_Change()
{
	//alert(xmlhttp.getAllResponseHeaders());
// if xmlhttp shows "loaded"
if (xmlhttp.readyState==4)
  {
  // if "OK"
  if (xmlhttp.status==200)
  {
//
  //alert(xmlhttp.getResponseHeader("Content-Type"));
  //alert(xmlhttp.responseText);
  document.getElementById('shipping').value=xmlhttp.responseText
  document.getElementById('shippingspan').innerHTML=xmlhttp.responseText
  document.getElementById('totalspan').innerHTML= (parseFloat(xmlhttp.responseText) + parseFloat(document.getElementById('amount').value)).toFixed(2);
  }
  else
  {
  alert("Problem retrieving shipping data:" + xmlhttp.statusText)
  }
  }
}


function shopgo()
{
	if (MM_findObj('item_name').value.indexOf('Promotion') == -1)
	{
	if (MM_findObj('shipping').value == 0)
	{
	alert('Please choose a shipping destination.')
	}
	else
	{
	if ((MM_findObj('promocode').value == decrypt('ZW9KQPZ:A:A')))
	{
		MM_findObj('amount').value = MM_findObj('amount').value - 1;
		MM_findObj('item_name').value = MM_findObj('item_name').value + ' (Promotion code £1 discount)'
	}
	MM_findObj('shopform').submit();
	}
	}
	else
	{
		alert('Please enter the promo code again, thank you.')
		MM_findObj('shopform').reset();
	}
}

function basketgo()
{
	/*if (MM_findObj('promocode').value == decrypt('PVSUTKXB'))
	{
		//alert('scooby doo');
		MM_findObj('amount').value = MM_findObj('amount').value - 5;
		MM_findObj('item_name').value = MM_findObj('item_name').value + ' (Promotion code £5 discount - ' + MM_findObj('promocode').value + ')';
		MM_findObj('basketform').submit();
		MM_findObj('basketform').reset();
		return;
		//
	}
	else
	{*/
	
	/*if (MM_findObj('promocode').value == decrypt('QZKZ;<:A'))
	{
		MM_findObj('amount').value = MM_findObj('amount').value - 10;
		MM_findObj('item_name').value = MM_findObj('item_name').value + ' (Promotion code £10 discount - ' + MM_findObj('promocode').value + ')';
		MM_findObj('basketform').submit();
		MM_findObj('basketform').reset();
		return;
	}
	else
	{*/
		if (MM_findObj('promocode').value  != '')
		{
		alert('This promotion code is not valid');
		return;
		}
	//}
	
	if (MM_findObj('item_name').value.indexOf('Promotion') == -1)
	{
	if ((MM_findObj('promocode').value == 'PMSC0807') || (MM_findObj('promocode').value == 'PASC0001') || (MM_findObj('promocode').value == 'MGAL0807') || (MM_findObj('promocode').value == 'EGAC0807') || (MM_findObj('promocode').value == 'CCCN0907') || (MM_findObj('promocode').value == 'GPAA0907') || (MM_findObj('promocode').value == 'GDAC0907') || (MM_findObj('promocode').value == 'ANAC0907') || (MM_findObj('promocode').value == 'PMAC0907') || (MM_findObj('promocode').value == 'KNAC0907' || (MM_findObj('promocode').value == 'PMAC1007') || (MM_findObj('promocode').value == 'EPAC0907')) || (MM_findObj('promocode').value == 'KMACQ307') || (MM_findObj('promocode').value == 'PMTR1107') || (MM_findObj('promocode').value == 'RCTR1107'))
	{
		alert('This promotion code has now expired');
		return
	}
	
	if ((MM_findObj('promocode').value == decrypt('ZW]M:B:A')) || (MM_findObj('promocode').value == decrypt('OQKM:B:A')) || (MM_findObj('promocode').value == decrypt('QZKK:C:A')) || (MM_findObj('promocode').value == decrypt('QNKM:C:A')) || (MM_findObj('promocode').value == decrypt('ZWKM:C:A')) || (MM_findObj('promocode').value == decrypt('KXKM:C:A')) || (MM_findObj('promocode').value == decrypt('ZWKM;::A')) || (MM_findObj('promocode').value == decrypt('UWKM[=:A')) || (MM_findObj('promocode').value == decrypt('^Q^M:;:B')))
	{
		MM_findObj('amount').value = MM_findObj('amount').value - 3;
		MM_findObj('item_name').value = MM_findObj('item_name').value + ' (Promotion code £3 discount - ' + MM_findObj('promocode').value + ')';
	}
	
	if (MM_findObj('promocode').value == decrypt('OZKM:C:A'))
	{
		MM_findObj('amount').value = MM_findObj('amount').value - 3;
		MM_findObj('item_name').value = MM_findObj('item_name').value + ' (Promotion code £3 discount - ' + MM_findObj('promocode').value + ')';
	}
	
	if (MM_findObj('promocode').value == decrypt('ZW^' + String.fromCharCode(92) + ';;:A'))
	{
		MM_findObj('amount').value = MM_findObj('amount').value - 2;
		MM_findObj('item_name').value = MM_findObj('item_name').value + ' (Promotion code £2 discount - ' + MM_findObj('promocode').value + ')';
	}
	
	if (MM_findObj('promocode').value == decrypt('' + String.fromCharCode(92) + 'M^' + String.fromCharCode(92) + ';;:A'))
	{
		MM_findObj('amount').value = MM_findObj('amount').value - 2;
		MM_findObj('item_name').value = MM_findObj('item_name').value + ' (Promotion code £2 discount - ' + MM_findObj('promocode').value + ')';
	}
	
	if (MM_findObj('promocode').value == decrypt('ZZKM;<:A'))
	{
		MM_findObj('amount').value = MM_findObj('amount').value - 2;
		MM_findObj('item_name').value = MM_findObj('item_name').value + ' (Promotion code £2 discount - ' + MM_findObj('promocode').value + ')';
	}
	
	
	
	
	
	if (MM_findObj('promocode').value == decrypt('WQKV:B:A') || (MM_findObj('promocode').value == decrypt(']MKM:;:B')))
	{
		MM_findObj('amount').value = MM_findObj('amount').value - 5;
		MM_findObj('item_name').value = MM_findObj('item_name').value + ' (Promotion code £5 discount - ' + MM_findObj('promocode').value + ')';
	}
	
	if (MM_findObj('promocode').value == decrypt('ZK]M:::;'))
	{
		MM_findObj('amount').value = MM_findObj('amount').value - 9;
		MM_findObj('item_name').value = MM_findObj('item_name').value + ' (Promotion code £9 discount - ' + MM_findObj('promocode').value + ')';
	}
	
	
	if (MM_findObj('promocode').value == decrypt('MMMX:C:A'))
	{
		MM_findObj('item_name').value = MM_findObj('item_name').value + ' (Promotion code UK Camera Club lecture - ' + MM_findObj('promocode').value + ')';
	}
	MM_findObj('basketform').submit();
	MM_findObj('basketform').reset();
	}
	else
	{
		alert('Please enter the promo code again, thank you.')
		MM_findObj('basketform').reset();
	}
}

function clearForms()
{
  var i;
  for (i = 0; (i < document.forms.length); i++) {
    document.forms[i].reset();
  }
}


function doshopsave()
{
	MM_findObj('f_name').value = MM_findObj('cms_name').innerHTML;
	MM_findObj('f_author').value = MM_findObj('cms_author').innerHTML;
	MM_findObj('f_price').value = MM_findObj('cms_price').innerHTML;
	MM_findObj('f_weight').value = MM_findObj('cms_weight').innerHTML;
	MM_findObj('f_price_comments').value = MM_findObj('cms_price_comments').innerHTML;
	MM_findObj('f_general_comments').value = MM_findObj('cms_general_comments').innerHTML;
	MM_findObj('f_descrip').value = MM_findObj('cms_descrip').innerHTML;
	MM_findObj('f_dateadded').value = MM_findObj('cms_dateadded').innerHTML;
	
	if (MM_findObj('oos').checked == true)
	{
		MM_findObj('f_outofstock').value = 1;
	}
	else
	{
		MM_findObj('f_outofstock').value = 0;
	}
	
	MM_findObj('cmsform').submit();
}


function setTC()
{
	el = document.getElementById('tcchecktext');
	elcheck = document.getElementById('tccheck');
	if (elcheck.checked)
	{
		el.value = 1;
	}
	else
	{
		el.value = 0;
	}
}




