function trim(str,ch){
	if(ch){
		return str.replace(ch,"");
	}else{
		return str.replace(/^\s+|\s+$/g,"");
	}
}
function ltrim(str,ch){
	if(ch){
		return str.replace(ch,"");
	}else{
		return str.replace(ch+/^\s+/,"");
	}
}
function rtrim(str,ch){
	if(ch){
		return str.replace(ch,"");
	}else{
		return str.replace(/\s+$/+ch,"");
	}
}
function sys_toggle(id,t,c,b){
	try{
		aR=new XMLHttpRequest();
	}
	catch(e){
		try{
			aR=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e){
			try{
				aR=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){
				show_notification('ffc6c6','1604','There was an AJAX request problem');
				return false;
			}
		}
	};
	aR.onreadystatechange=function(){
		if(aR.readyState==4){
			if(t=='featuredcontent'&&c=='active'){
				system_writefc();
			}
		}
	};
	aR.open("GET","system/sys_toggle.php?id="+escape(id)+"&t="+escape(t)+"&c="+escape(c)+"&b="+escape(b),true);
	aR.send(null);
}
function show_notification(id,i,txt){
	txt='<img src="system/images/'+i+'.png" alt="" />'+txt;
	if(i=='4200'||i=='4201'||i=='4204'){
		$('#'+id).jGrowl(txt,{life:5000});
	}else{
		$('#'+id).jGrowl(txt);
	}
}
function sys_popinfo(id){
	document.getElementById('popper').innerHTML='<div class="title"></div><div class="content"><img src="system/images/lock0.png" width="100" height="100" style="background:transparent url(system/images/0.gif) no-repeat center center;" />Loading Data....</div>';
	try{
		aR=new XMLHttpRequest();
	}
	catch(e){
		try{
			aR=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e){
			try{
				aR=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){
				show_notification('system','4204','There was an AJAX request problem');
				return false;
			}
		}
	};
	aR.onreadystatechange=function(){
		if(aR.readyState==4){
			document.getElementById('popper').innerHTML=aR.responseText;
			$(".products").tooltip({tip:'#popper',effect:'fade'});
		}
	};
	aR.open("GET","system/popper.php?id="+escape(id),true);
	aR.send(null);
}
function sys_popinfo2(id){
	document.getElementById('popper').innerHTML='<div class="title"></div><div class="content"><img src="system/images/lock0.png" width="100" height="100" style="background:transparent url(system/images/0.gif) no-repeat center center;" />Loading Data....</div>';
	try{
		aR=new XMLHttpRequest();
	}
	catch(e){
		try{
			aR=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e){
			try{
				aR=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){
				show_notification('system','4204','There was an AJAX request problem');
				return false;
			}
		}
	};
	aR.onreadystatechange=function(){
		if(aR.readyState==4){
			document.getElementById('popper').innerHTML=aR.responseText;
			$(".products2").tooltip({tip:'#popper',effect:'fade'});
		}
	};
	aR.open("GET","system/popper2.php?id="+escape(id),true);
	aR.send(null);
}
function capMe(txt){
	txt=txt.replace(/_/i," ");
	newVal='';
	val=txt.split(' ');
	for(var c=0;c<val.length;c++){
		newVal+=val[c].substring(0,1).toUpperCase()+val[c].substring(1,val[c].length)+' ';
	}
	return newVal;
}
function sys_update(id,t,c){
	try{
		aR=new XMLHttpRequest();
	}
	catch(e){
		try{
			aR=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e){
			try{
				aR=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){
				show_notification('system','4204','There was an AJAX request problem');
				return false;
			}
		}
	};
	aR.onreadystatechange=function(){
		if(aR.readyState==4){
			show_notification('system','4202','Saved Successfully!');
		}
	};
	aR.open("GET","system/sys_update.php?id="+escape(id)+"&t="+escape(t)+"&c="+escape(c)+"&da="+escape(document.getElementById(t+c+id).value),true);
	aR.send(null);
}
function sys_redisp(el){
	if(el=='pages-list'){
		p='sys_pages-list.php';
	}
	if(el=='fc-list'){
		p='sys_fc-list.php';
	}
	if(el=='wm'){
		p='sys_wm.php';
	}
	try{
		aR=new XMLHttpRequest();
	}
	catch(e){
		try{
			aR=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e){
			try{
				aR=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){
				show_notification('system','4204','There was an AJAX request problem');
				return false;
			}
		}
	};
	aR.onreadystatechange=function(){
		if(aR.readyState==4){
			document.getElementById(el).innerHTML=aR.responseText;
		}
	};
	aR.open("GET","system/"+p,true);
	aR.send(null);
}
function sys_controltoggle(id,t,s){
	t2=t;
	if(t=='blog_comments'){
		t2=ltrim(t,'blog_');
	}
	t2=t2.slice(0,-1);
	if(s==1){
		txt='<span class="action" onclick="sys_toggle(\''+id+'\',\''+t+'\',\'active\',\'0\');sys_controltoggle(\''+id+'\',\''+t+'\',\'0\');">Hide '+capMe(t2)+'</span><br />';
	}else{
		txt='<span class="action" onclick="sys_toggle(\''+id+'\',\''+t+'\',\'active\',\'0\');sys_controltoggle(\''+id+'\',\''+t+'\',\'1\');">Show '+capMe(t2)+'</span><br />';
	}
	txt+='<span class="action" onclick="sys_delete(\''+id+'\',\''+t+'\');">Delete '+capMe(t2)+'</span><br />';
	document.getElementById('control'+id).innerHTML=txt;
}
function sys_ampm(){
	el1=document.getElementById('ampm');
	el2=document.getElementById('ampmc');
	if(el1.value=='am'){
		el1.value='pm';
		el2.innerHTML='PM';
	}else{
		el1.value='am';el2.innerHTML='AM';
	}
}
function sys_delete(id,t){
	if(confirm("Are you Sure?")){
		try{
			aR=new XMLHttpRequest();
		}
		catch(e){
			try{
				aR=new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch(e){
				try{
					aR=new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch(e){
					show_notification('system','4204','There was an AJAX request problem');
					return false;
				}
			}
		};
		aR.onreadystatechange=function(){
			if(aR.readyState==4){
				show_notification('system','4202',capMe(t)+' Item Deleted Successfully!');
				if(t=='gallery'||t=='images'||t=='progress'){
					document.getElementById('l1I_'+id).style.display='none';
				}else{
					document.getElementById('item'+id).style.display='none';
				}
				if(t=='users'){
					document.getElementById('item2'+id).style.display='none';
				}
			}
		};
		aR.open("GET","system/sys_delete.php?id="+escape(id)+"&t="+escape(t),true);
		aR.send(null);
	}
}
function sys_pagedel(id){
	if(confirm("Are you Sure?")){
		try{
			aR=new XMLHttpRequest();
		}
		catch(e){
			try{
				aR=new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch(e){
				try{
					aR=new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch(e){
					show_notification('system','4204','There was an AJAX request problem');
					return false;
				}
			}
		};
		aR.onreadystatechange=function(){
			if(aR.readyState==4){
				document.getElementById('overlay').innerHTML=aR.responseText;
				sys_redisp('page-list');
			}
		};
		aR.open("GET","system/sys_pagedel.php?id="+escape(id),true);
		aR.send(null);
	}
}
function sys_fcdel(id){
	if(confirm("Are you Sure?")){
		try{
			aR=new XMLHttpRequest();
		}
		catch(e){
			try{
				aR=new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch(e){
				try{
					aR=new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch(e){
					show_notification('system','4204','There was an AJAX request problem');
					return false;
				}
			}
		};
		aR.onreadystatechange=function(){
			if(aR.readyState==4){
				show_notification('system','4202','Image Deleted Successfully!');
				sys_redisp('fc-list');
			}
		};
		aR.open("GET","system/sys_delfc.php?id="+escape(id),true);
		aR.send(null);
	}
}
function sys_dispaddlink(){
	html='<input id="link" type="text" value="" onchange="sys_addlink();" /><br />';
	html+='Add link Title and URL seperated by a comma.<br />e.g., gnuSite,http://gnusite.studiojunkyard.com/';
	document.getElementById('addlink').innerHTML=html;
}
function sys_addlink(){
	txt=document.getElementById('link').value;
	if(txt!=''){
		var t=new Array();
		t=txt.split(',');
		if(t[1]==null){
			t[1]=t[0];
		}
		try{
			aR=new XMLHttpRequest();
		}
		catch(e){
			try{
				aR=new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch(e){
				try{
					aR=new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch(e){
					show_notification('system','4204','There was an AJAX request problem');
					return false;
				}
			}
		};
		aR.onreadystatechange=function(){
			if(aR.readyState==4){
				html=document.getElementById('newlinks').innerHTML;
				html+='<br /><a target="_blank" href="http://'+unescape(t[1])+'">'+unescape(t[0])+'</a>';
				document.getElementById('newlinks').innerHTML=html;
				sys_dispaddlinkreset();
			}
		};
		aR.open("GET","system/sys_addlink.php?t="+escape(t[0])+"&u="+escape(t[1]),true);
		aR.send(null);
	}
}
function sys_dispaddlinkreset(){
	html='<span onclick="sys_dispaddlink();">add link</span>';
	document.getElementById('addlink').innerHTML=html;
}
function sys_dellink(id){
	if(confirm("Are you Sure?")){
		try{
			aR=new XMLHttpRequest();
		}
		catch(e){
			try{
				aR=new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch(e){
				try{
					aR=new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch(e){
					show_notification('system','4204','There was an AJAX request problem');
					return false;
				}
			}
		};
		aR.onreadystatechange=function(){
			if(aR.readyState==4){
				el=document.getElementById('lnk'+id);
				el.parentNode.removeChild(el);
			}
		};
		aR.open("GET","system/sys_dellink.php?id="+escape(id),true);
		aR.send(null);
	}
}
function sys_adduser(){
	try{
		aR=new XMLHttpRequest();
	}
	catch(e){
		try{
			aR=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e){
			try{
				aR=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){
				show_notification('system','4204','There was an AJAX request problem');
				return false;
			}
		}
	};
	aR.onreadystatechange=function(){
		if(aR.readyState==4){
			document.getElementById('sp').innerHTML=aR.responseText;
		}
	};
	aR.open("GET","system/sys_adduser.php?nu="+escape(document.getElementById('nu').value),true);
	aR.send(null);
}
function sys_showuser(id){
	el=document.getElementById('user'+id);
	if(el.style.display=='block'){
		el.style.display='none';
	}else{
		try{
			aR=new XMLHttpRequest();
		}
		catch(e){
			try{
				aR=new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch(e){
				try{
					aR=new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch(e){
					show_notification('system','4204','There was an AJAX request problem');
					return false;
				}
			}
		};
		aR.onreadystatechange=function(){
			if(aR.readyState==4){
				el.innerHTML=aR.responseText;el.style.display='block';
			}
		};
		aR.open("GET","system/sys_showuser.php?id="+escape(id),true);
		aR.send(null);
	}
}
function sys_lockscreen(){
	el=document.getElementById('overlay').style.display='block';
}
function sys_unlockscreen(){
	el=document.getElementById('overlay').style.display='none';
}
function sys_enqtype(){
	t=document.getElementById('enqtype').value;
	e=document.getElementById('enqtype4');
	if(t=='Product Search'){
		e.style.display='block';
	}else{
		e.style.display='none';
	}
}
function sys_getcountry(id){
	el=document.getElementById('country'+id);
	if(el.style.display=='block'){
		el.style.display='none';
	}else{
		try{
			aR=new XMLHttpRequest();
		}
		catch(e){
			try{
				aR=new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch(e){
				try{
					aR=new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch(e){
					show_notification('system','4204','There was an AJAX request problem');
					return false;
				}
			}
		};
		aR.onreadystatechange=function(){
			if(aR.readyState==4){
				el.innerHTML=aR.responseText;el.style.display='block';
			}
		};
		aR.open("GET","system/sys_showuser.php?id="+escape(id),true);
		aR.send(null);
	}
}
function sys_addccu(){
	el=document.getElementById('ccu');
	txt=el.value;
	if(txt=='Add URL eg. AU,www.australia.com.au'){
		return;
	}else if(txt==''){
		el.value='Add URL eg. AU,www.australia.com.au';
		return;
	}else{
		var t=new Array();
		t=txt.split(',');
		try{
			aR=new XMLHttpRequest();
		}
		catch(e){
			try{
				aR=new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch(e){
				try{
					aR=new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch(e){
					show_notification('system','4204','There was an AJAX request problem');
					return false;
				}
			}
		};
		aR.onreadystatechange=function(){
			if(aR.readyState==4){
				document.getElementById('addcc').innerHTML=aR.responseText;
				el.value='Add URL eg. AU,www.australia.com.au';
			}
		};
		aR.open("GET","system/sys_addccu.php?c="+escape(t[0])+"&u="+escape(t[1]),true);
		aR.send(null);
	}
}
function sys_delccu(id){
	if(confirm("Are you Sure?")){
		try{
			aR=new XMLHttpRequest();
		}
		catch(e){
			try{
				aR=new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch(e){
				try{
					aR=new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch(e){
					show_notification('system','4204','There was an AJAX request problem');
					return false;
				}
			}
		};
		aR.onreadystatechange=function(){
			if(aR.readyState==4){
				document.getElementById('addcc').innerHTML=aR.responseText;
			}
		};
		aR.open("GET","system/sys_delccu.php?id="+escape(id),true);
		aR.send(null);
	}
}
function sys_addintp(){
	el=document.getElementById('addintp');
	if(el.value!=''){
		try{
			aR=new XMLHttpRequest();
		}
		catch(e){
			try{
				aR=new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch(e){
				try{
					aR=new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch(e){
					show_notification('system','4204','There was an AJAX request problem');
					return false;
				}
			}
		};
		aR.onreadystatechange=function(){
			if(aR.readyState==4){
				document.getElementById('addint').innerHTML=aR.responseText;
			}
		};
		aR.open("GET","system/sys_addintp.php?cc="+escape(el.value),true);
		aR.send(null);
	}
}
function sys_getpcode(){
	el=document.getElementById('pcode');
	txt=el.value;
	if(txt.length>2){
		if(isNaN(txt)){
			show_notification('system','4201','Only numbers and at least 3 are accepted in the Post Code Field!');
		}else{
			try{
				aR=new XMLHttpRequest();
			}
			catch(e){
				try{
					aR=new ActiveXObject("Msxml2.XMLHTTP");
				}
				catch(e){
					try{
						aR=new ActiveXObject("Microsoft.XMLHTTP");
					}
					catch(e){
						show_notification('system','4204','There was an AJAX request problem');
						return false;
					}
				}
			};
			aR.onreadystatechange=function(){
				if(aR.readyState==4){
					document.getElementById('dpc').innerHTML=aR.responseText;
					document.getElementById('dpc').style.display='block';
					document.getElementById('pcb').style.display='none';
				}
			};
			document.getElementById('pcb').style.display='block';
			aR.open("GET","system/sys_getpcode.php?pc="+escape(txt),true);
			aR.send(null);
		}
	}else{
		document.getElementById('dpc').innerHTML='';
		document.getElementById('dpc').style.display='none';
		document.getElementById('pcb').style.display='none';
	}
}
function sys_sysgetpcode(){
	el=document.getElementById('pcode');
	txt=el.value;
	if(txt.length>2){
		if(isNaN(txt)){
			show_notification('system','4201','Only numbers and at least 3 are accepted in the Post Code Field!');
		}else{
			try{
				aR=new XMLHttpRequest();
			}
			catch(e){
				try{
					aR=new ActiveXObject("Msxml2.XMLHTTP");
				}
				catch(e){
					try{
						aR=new ActiveXObject("Microsoft.XMLHTTP");
					}
					catch(e){
						show_notification('system','4204','There was an AJAX request problem');
						return false;
					}
				}
			};
			aR.onreadystatechange=function(){
				if(aR.readyState==4){
					document.getElementById('dpc').innerHTML=aR.responseText;
					document.getElementById('dpc').style.display='block';
				}
			};
			document.getElementById('dpc').style.display='block';
			aR.open("GET","system/sys_getpcode.php?pc="+escape(txt),true);
			aR.send(null);
		}
	}else{
		document.getElementById('dpc').innerHTML='';document.getElementById('dpc').style.display='none';
	}
}
function sys_putpcode(cc,co,st,su){
	document.getElementById('cc').value=cc;
	document.getElementById('co').value=co;
	document.getElementById('st').value=st;
	document.getElementById('sta').value=st;
	document.getElementById('su').value=su;
	document.getElementById('sub').value=su;
	document.getElementById('dpc').style.display='none';
}
function sys_delpostcodes(cc){
	if(confirm("Are you Sure?")){
		try{
			aR=new XMLHttpRequest();
		}
		catch(e){
			try{
				aR=new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch(e){
				try{
					aR=new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch(e){
					show_notification('system','4204','There was an AJAX request problem');
					return false;
				}
			}
		};
		aR.onreadystatechange=function(){
			if(aR.readyState==4){
				document.getElementById('spd').innerHTML=aR.responseText;
			}
		};
		aR.open("GET","system/sys_delpostcodes.php?cc="+escape(cc),true);
		aR.send(null);
	}
}
function sys_movebooking(id,d,m){
	d=d*24*60*60;
	m=m*60;
	try{
		aR=new XMLHttpRequest();
	}
	catch(e){
		try{
			aR=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e){
			try{
				aR=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){
				show_notification('system','4204','There was an AJAX request problem');
				return false;
			}
		}
	};
	aR.onreadystatechange=function(){
		if(aR.readyState==4){
		}
	};
	aR.open("GET","system/sys_movebooking.php?id="+escape(id)+"&d="+escape(d)+"&m="+escape(m),true);
	aR.send(null);
}
function sys_extendbooking(id,d,m){
	d=d*24*60*60;
	m=m*60;
	try{
		aR=new XMLHttpRequest();
	}
	catch(e){
		try{
			aR=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e){
			try{
				aR=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){
				show_notification('system','4204','There was an AJAX request problem');
				return false;
			}
		}
	};
	aR.onreadystatechange=function(){
		if(aR.readyState==4){
		}
	};
	aR.open("GET","system/sys_extendbooking.php?id="+escape(id)+"&d="+escape(d)+"&m="+escape(m),true);
	aR.send(null);
}
function sys_makebooking(d){
	try{
		aR=new XMLHttpRequest();
	}
	catch(e){
		try{
			aR=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e){
			try{
				aR=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){
				show_notification('system','4204','There was an AJAX request problem');
				return false;
			}
		}
	};
	aR.onreadystatechange=function(){
		if(aR.readyState==4){
			document.getElementById('overlay').innerHTML=aR.responseText;
			document.getElementById('overlay').style.display='block';
		}
	};
	aR.open("GET","system/sys_makebooking.php?d="+escape(d),true);
	aR.send(null);
}
function sys_showbooking(id){
	try{
		aR=new XMLHttpRequest();
	}
	catch(e){
		try{
			aR=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e){
			try{
				aR=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){
				show_notification('system','4204','There was an AJAX request problem');
				return false;
			}
		}
	};
	aR.onreadystatechange=function(){
		if(aR.readyState==4){
			document.getElementById('overlay').innerHTML=aR.responseText;
			document.getElementById('overlay').style.display='block';
		}
	};
	aR.open("GET","system/sys_showbook.php?id="+escape(id),true);
	aR.send(null);
}
function sys_delbooking(id){
	if(confirm("Are you Sure?")){
		try{
			aR=new XMLHttpRequest();
		}
		catch(e){
			try{
				aR=new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch(e){
				try{
					aR=new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch(e){
					show_notification('system','4204','There was an AJAX request problem');
					return false;
				}
			}
		};
		aR.onreadystatechange=function(){
			if(aR.readyState==4){
				document.getElementById('overlay').style.display='none';
				location.reload(true);
			}
		};
		aR.open("GET","system/sys_delbook.php?id="+escape(id),true);
		aR.send(null);
	}
}
function sys_addbooktype(){
	try{
		aR=new XMLHttpRequest();
	}
	catch(e){
		try{
			aR=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e){
			try{
				aR=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){
				show_notification('system','4204','There was an AJAX request problem');
				return false;
			}
		}
	};
	aR.onreadystatechange=function(){
		if(aR.readyState==4){
			document.getElementById('b').innerHTML=aR.responseText;
		}
	};
	aR.open("GET","system/sys_addbooktype.php?bt="+escape(document.getElementById('bt').value),true);
	aR.send(null);
}
function sys_delbooktype(id){
	if(confirm("Are you Sure?")){
		try{
			aR=new XMLHttpRequest();
		}
		catch(e){
			try{
				aR=new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch(e){
				try{
					aR=new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch(e){
					show_notification('system','4204','There was an AJAX request problem');
					return false;
				}
			}
		};
		aR.onreadystatechange=function(){
			if(aR.readyState==4){
				document.getElementById('b').innerHTML=aR.responseText;
			}
		};
		aR.open("GET","system/sys_delbooktype.php?id="+escape(id),true);
		aR.send(null);
	}
}
function sys_addposttype(){
	pt=escape(document.getElementById('pot').value);
	if(pt==''){
		show_notification("system","4204","You didn't enter anything to add");
	}else{
		try{
			aR=new XMLHttpRequest();
		}
		catch(e){
			try{
				aR=new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch(e){
				try{
					aR=new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch(e){
					show_notification('system','4204','There was an AJAX request problem');
					return false;
				}
			}
		};
		aR.onreadystatechange=function(){
			if(aR.readyState==4){
				document.getElementById('potd').innerHTML=aR.responseText;
			}
		};
		aR.open("GET","system/sys_addposttype.php?pt="+pt,true);
		aR.send(null);
	}
}
function sys_delposttype(id){
	if(confirm("Are you Sure?")){
		try{
			aR=new XMLHttpRequest();
		}
		catch(e){
			try{
				aR=new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch(e){
				try{
					aR=new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch(e){
					show_notification('system','4204','There was an AJAX request problem');
					return false;
				}
			}
		};
		aR.onreadystatechange=function(){
			if(aR.readyState==4){
				document.getElementById('potd').innerHTML=aR.responseText;
			}
		};
		aR.open("GET","system/sys_delposttype.php?id="+escape(id),true);
		aR.send(null);
	}
}
function sys_addpaytype(){
	pt=escape(document.getElementById('pat').value);
	if(pt==''){
		show_notification("system","4204","You didn't enter anything to add");
	}else{
		try{
			aR=new XMLHttpRequest();
		}
		catch(e){
			try{
				aR=new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch(e){
				try{
					aR=new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch(e){
					show_notification('system','4204','There was an AJAX request problem');
					return false;
				}
			}
		};
		aR.onreadystatechange=function(){
			if(aR.readyState==4){
				document.getElementById('patd').innerHTML=aR.responseText;
			}
		};
		aR.open("GET","system/sys_addpaytype.php?pt="+pt,true);
		aR.send(null);
	}
}
function sys_delpaytype(id){
	if(confirm("Are you Sure?")){
		try{
			aR=new XMLHttpRequest();
		}
		catch(e){
			try{
				aR=new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch(e){
				try{
					aR=new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch(e){
					show_notification('system','4204','There was an AJAX request problem');
					return false;
				}
			}
		};
		aR.onreadystatechange=function(){
			if(aR.readyState==4){
				document.getElementById('patd').innerHTML=aR.responseText;
			}
		};
		aR.open("GET","system/sys_delpaytype.php?id="+escape(id),true);
		aR.send(null);
	}
}
function sys_emlbooking(id){
	try{
		aR=new XMLHttpRequest();
	}
	catch(e){
		try{
			aR=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e){
			try{
				aR=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){
				show_notification('system','4204','There was an AJAX request problem');
				return false;
			}
		}
	};
	aR.onreadystatechange=function(){
		if(aR.readyState==4){
			if(aR.responseText==1){
				show_notification('system','4201','Email Sent!');
			}else{
				show_notification('system','4204','There was a problem sending the email!');
			}
		}
	};
	aR.open("GET","system/sys_emlbookinging.php?id="+escape(id),true);
	aR.send(null);
}
function sys_addcontacttype(){
	try{
		aR=new XMLHttpRequest();
	}
	catch(e){
		try{
			aR=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e){
			try{
				aR=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){
				show_notification('system','4204','There was an AJAX request problem');
				return false;
			}
		}
	};
	aR.onreadystatechange=function(){
		if(aR.readyState==4){
			document.getElementById('c').innerHTML=aR.responseText;
		}
	};
	aR.open("GET","system/sys_addcontacttype.php?ct="+escape(document.getElementById('ct').value),true);
	aR.send(null);
}
function sys_delcontacttype(id){
	if(confirm("Are you Sure?")){
		try{
			aR=new XMLHttpRequest();
		}
		catch(e){
			try{
				aR=new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch(e){
				try{
					aR=new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch(e){
					show_notification('system','4204','There was an AJAX request problem');
					return false;
				}
			}
		};
		aR.onreadystatechange=function(){
			if(aR.readyState==4){
				document.getElementById('c').innerHTML=aR.responseText;
			}
		};
		aR.open("GET","system/sys_delcontacttype.php?id="+escape(id),true);
		aR.send(null);
	}
}
function sys_addproduct(u){
	try{
		aR=new XMLHttpRequest();
	}
	catch(e){
		try{
			aR=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e){
			try{
				aR=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){
				show_notification('system','4204','There was an AJAX request problem');
				return false;
			}
		}
	};
	aR.onreadystatechange=function(){
		if(aR.readyState==4){
			document.getElementById('overlay').innerHTML=aR.responseText;
			sys_lockscreen();
		}
	};
	aR.open("GET","system/sys_addproduct.php?u="+escape(u),true);
	aR.send(null);
}
function sys_addservice(u){
	try{
		aR=new XMLHttpRequest();
	}
	catch(e){
		try{
			aR=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e){
			try{
				aR=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){
				show_notification('system','4204','There was an AJAX request problem');
				return false;
			}
		}
	};
	aR.onreadystatechange=function(){
		if(aR.readyState==4){
			document.getElementById('overlay').innerHTML=aR.responseText;
			sys_lockscreen();
		}
	};
	aR.open("GET","system/sys_addservice.php?u="+escape(u),true);
	aR.send(null);
}
function sys_addportfolio(u){
	try{
		aR=new XMLHttpRequest();
	}
	catch(e){
		try{
			aR=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e){
			try{
				aR=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){
				show_notification('system','4204','There was an AJAX request problem');
				return false;
			}
		}
	};
	aR.onreadystatechange=function(){
		if(aR.readyState==4){
			document.getElementById('overlay').innerHTML=aR.responseText;
			sys_lockscreen();
		}
	};
	aR.open("GET","system/sys_addportfolio.php?u="+escape(u),true);
	aR.send(null);
}
function voteproduct(id){
	voted=getCookie('product'+id);
	if(voted!=null&&voted!=''){
		alert("You have already voted for this product. You may only vote once...");
	}else{
		var cookie_date=new Date(2038,01,01);
		setCookie('product'+id+'='+id+';expires='+cookie_date.toGMTString());
		try{
			aR=new XMLHttpRequest();
		}
		catch(e){
			try{
				aR=new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch(e){
				try{
					aR=new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch(e){
					alert("Brokened!");
					return false;
				}
			}
		};
		aR.onreadystatechange=function(){
			if(aR.readyState==4){
			}
		};
		aR.open("GET","system/sys_vote.php?id="+escape(id),true);
		aR.send(null);
	}
}
function getCookie(c_name){
	if(document.cookie.length>0){
		c_start=document.cookie.indexOf(c_name+"=");
		if(c_start!=-1){
			c_start=c_start+c_name.length+1;
			c_end=document.cookie.indexOf(";",c_start);
			if(c_end==-1)c_end=document.cookie.length;
			return unescape(document.cookie.substring(c_start,c_end));
		}
	}
	return "";
}
function setCookie(c_name,value,expiredays){
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+"="+escape(value)+((expiredays==null)?"":";expires="+exdate.toGMTString());
}
function addtocart(id,si){
	try{
		aR=new XMLHttpRequest();
	}
	catch(e){
		try{
			aR=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e){
			try{
				aR=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){
				show_notification('system','4204','There was an AJAX request problem');
				return false;
			}
		}
	};
	aR.onreadystatechange=function(){
		if(aR.readyState==4){
			document.getElementById('cartqty').innerHTML=aR.responseText;
			document.getElementById('plord').innerHTML='<a href="placeorder.php">Click here to place your order.</a>';
		}
	};
	aR.open("GET","system/sys_addtocart.php?id="+escape(id)+"&si="+escape(si),true);
	aR.send(null);
}
function addstocart(id,si){
	try{
		aR=new XMLHttpRequest();
	}
	catch(e){
		try{
			aR=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e){
			try{
				aR=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){
				show_notification('system','4204','There was an AJAX request problem');
				return false;
			}
		}
	};
	aR.onreadystatechange=function(){
		if(aR.readyState==4){
			document.getElementById('cartqty').innerHTML=aR.responseText;
			document.getElementById('plord').innerHTML='<a href="placeorder.php">Click here to place your order.</a>';
		}
	};
	aR.open("GET","system/sys_addstocart.php?id="+escape(id)+"&si="+escape(si),true);
	aR.send(null);
}
function sys_updateprice(id,c){
	try{
		aR=new XMLHttpRequest();
	}
	catch(e){
		try{
			aR=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e){
			try{
				aR=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){
				show_notification('system','4204','There was an AJAX request problem');
				return false;
			}
		}
	};
	aR.onreadystatechange=function(){
		if(aR.readyState==4){
			if(c=="p"){
				e3='Price Updated!';
			}
			if(c=="po"){
				e3='Price Overide Updated!';
			}
			if(c=="pw"){
				e3='Wholesale Price Updated!';
			}
			if(c=="rrp"){
				e3='RRP Updated!';
			}
			if(c=="sp"){
				e3='Special Price Updated!';
			}
			show_notification('system','4202',e3);
			document.getElementById('catpr').innerHTML=aR.responseText;
		}
	};
	aR.open("GET","system/sys_updateprice.php?id="+escape(id)+"&c="+escape(c)+"&d="+escape(document.getElementById(c+id).value),true);
	aR.send(null);
}
function sys_qtyupdate(id){
	try{
		aR=new XMLHttpRequest();
	}
	catch(e){
		try{
			aR=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e){
			try{
				aR=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){
				show_notification('system','4204','There was an AJAX request problem');
				return false;
			}
		}
	};
	aR.onreadystatechange=function(){
		if(aR.readyState==4){
			document.getElementById('ordrecalc').innerHTML=aR.responseText;
		}
	};
	aR.open("GET","system/sys_qtyupdate.php?id="+escape(id)+"&qty="+escape(document.getElementById('qty'+id).value),true);
	aR.send(null);
}
function sys_placeorder(){
	er=0;
	si=escape(document.getElementById('si').value);
	uid=escape(document.getElementById('uid').value);
	eml=escape(document.getElementById('eml').value);
	if(eml==''&&uid==0){
		er=1;
		document.getElementById('emler').style.display='block';
	}else{
		el=document.getElementById('emler');
		if(el.style.display=='block'){
			document.getElementById('emler').style.display='none';
		}
	}
	rc=escape(document.getElementById('rc').value);
	pt=escape(document.getElementById('pt').value);
	if(pt=='none'){
		er=1;
		document.getElementById('pter').style.display='block';
	}else{
		el=document.getElementById('pter');
		if(el.style.display=='block'){
			document.getElementById('pter').style.display='none';
		}
	}
	po=escape(document.getElementById('po').value);
	if(po=='none'){
		er=1;
		document.getElementById('poer').style.display='block';
	}else{
		el=document.getElementById('poer');
		if(el.style.display=='block'){
			document.getElementById('poer').style.display='none';
		}
	}
	if($('#co:checked').val()!=null){
		co=1;
	}else{
		co=0;
	}
	if(er==0){
		try{
			aR=new XMLHttpRequest();
		}
		catch(e){
			try{
				aR=new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch(e){
				try{
					aR=new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch(e){
					show_notification('system','4204','There was an AJAX request problem');
					return false;
				}
			}
		};
		aR.onreadystatechange=function(){
			if(aR.readyState==4){
				document.getElementById('orderconfirm').innerHTML=aR.responseText;
			}
		};
		aR.open("GET","system/sys_placeorder.php?si="+escape(si)+"&uid="+escape(uid)+"&eml="+escape(eml)+"&rc="+escape(rc)+"&pt="+escape(pt)+"&po="+escape(po)+"&co="+escape(co),true);
		aR.send(null);
	}
}
function sys_addreward(){
	uid=escape(document.getElementById('ruid').value);
	c=escape(document.getElementById('rc').value);
	t=escape(document.getElementById('rt').value);
	m=escape(document.getElementById('rm').value);
	v=escape(document.getElementById('rv').value);
	s=escape(document.getElementById('rst').value);
	e=escape(document.getElementById('rex').value);
	u=escape(document.getElementById('ru').value);
	try{
		aR=new XMLHttpRequest();
	}
	catch(e){
		try{
			aR=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e){
			try{
				aR=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){
				show_notification('system','4204','There was an AJAX request problem');
				return false;
			}
		}
	};
	aR.onreadystatechange=function(){
		if(aR.readyState==4){
			document.getElementById('rewadd').innerHTML=aR.responseText;
		}
	};
	aR.open("GET","system/sys_rewadd.php?uid="+uid+"&c="+c+"&t="+t+"&m="+m+"&v="+v+"&s="+s+"&e="+e+"&u="+u,true);
	aR.send(null);
}
function sys_rewdel(id){
	if(confirm("Are you sure?")){
		try{
			aR=new XMLHttpRequest();
		}
		catch(e){
			try{
				aR=new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch(e){
				try{
					aR=new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch(e){
					show_notification('system','4204','There was an AJAX request problem');
					return false;
				}
			}
		};
		aR.onreadystatechange=function(){
			if(aR.readyState==4){
				document.getElementById('rewadd').innerHTML=aR.responseText;
			}
		};
		aR.open("GET","system/sys_rewdel.php?id="+escape(id),true);
		aR.send(null);
	}
}