

var xmlHttp

function GetXmlHttpObject()
{ 
		var objXMLHttp=null
		
		if (window.XMLHttpRequest)
		{
			objXMLHttp=new XMLHttpRequest()
		}
		else if (window.ActiveXObject)
		{
			objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
		}
		
		return objXMLHttp
}function createNewCss(form, pid)
{
		xmlHttp=GetXmlHttpObject()
		
		if (xmlHttp==null)
		{
				alert ("Browser does not support HTTP Request")
				return
		} 	
		
		
		var url="/admin/webpages/createcss.php";
		strb="name="+form.cssName.value+"&type="+form.cssChoice.value+"&pid="+pid+"&page="+form.page.value+"&acl="+form.acl.value;
		
		xmlHttp.onreadystatechange=stateChangeNewCSS
		xmlHttp.open("POST",url,true);
		xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
		xmlHttp.send(strb);	
		
} 

function stateChangeNewCSS() 
{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
				document.getElementById("newcssconfim").
				innerHTML=xmlHttp.responseText;
		} 
} function createNewFeature(form)
{
		xmlHttp=GetXmlHttpObject()
		
		if (xmlHttp==null)
		{
				alert ("Browser does not support HTTP Request")
				return
		} 	
		
		
		var url="/admin/webpages/createfeature.php";
		strb="feature="+form.cssFeature.value;
		
		xmlHttp.onreadystatechange=stateChangeNewCSSFeature
		xmlHttp.open("POST",url,true);
		xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
		xmlHttp.send(strb);	
		
} 

function stateChangeNewCSSFeature() 
{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
				document.getElementById("newfeatureconfim").
				innerHTML=xmlHttp.responseText;
		} 
} function createNewOption(form)
{
		xmlHttp=GetXmlHttpObject()
		
		if (xmlHttp==null)
		{
				alert ("Browser does not support HTTP Request")
				return
		} 	
		
		
		var url="/admin/webpages/createoption.php";
		strb="option="+form.cssOption.value+"&cssid="+form.cssFIDs.value;
		
		xmlHttp.onreadystatechange=stateChangeNewOptionFeature
		xmlHttp.open("POST",url,true);
		xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
		xmlHttp.send(strb);	
		
} 

function stateChangeNewOptionFeature() 
{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
				document.getElementById("newoptionconfim").
				innerHTML=xmlHttp.responseText;
		} 
} function getCSSInfo(cssID)
{
		xmlHttp=GetXmlHttpObject()
		
		if (xmlHttp==null)
		{
				alert ("Browser does not support HTTP Request")
				return
		} 	
		
		
		var url="/admin/webpages/getcssinfo.php";
		strb="id="+cssID;
		
		xmlHttp.onreadystatechange=stateChangeGetCSSInfo
		xmlHttp.open("POST",url,true);
		xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
		xmlHttp.send(strb);	
		
} 

function stateChangeGetCSSInfo() 
{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
				document.getElementById("currentcssinfo").
				innerHTML=xmlHttp.responseText;
		} 
} function submitCSSInfo(form)
{
		xmlHttp=GetXmlHttpObject()
		
		if (xmlHttp==null)
		{
				alert ("Browser does not support HTTP Request")
				return
		} 		
		
		var url="/admin/webpages/submitcssinfo.php";
		
	for(i=0; i<form.elements.length; i++)
	{
		if(i==0)
		{
			strb=form.elements[i].name + "=" + form.elements[i].value;		
		}
		else
		{
			strb+="&"+form.elements[i].name + "=" + form.elements[i].value;
		}	
			
	}



		
		xmlHttp.onreadystatechange= stateChangeSubmitCSSInfo
		xmlHttp.open("POST",url,true);
		xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
		xmlHttp.send(strb);	
		
} 

function stateChangeSubmitCSSInfo() 
{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
				document.getElementById("currentcssinfo").
				innerHTML=xmlHttp.responseText;
		} 
} //myField accepts an object reference, myValue accepts the text strint to add
function insertAtCursor(myField, Type) {
//IE support

var tag = window.prompt("Class or ID Information (class=\"box5\"):",'')

if(tag!=null)
{

if(Type=='img')
{
var path=window.prompt("Path:","");
var alt=window.prompt("Alt:","");

myValue='<'+Type+' src="'+path+'" '+'alt="'+alt+'" />';
}
else
{
myValue= "<"+Type+" "+tag+">"+window.prompt("Content:","")+"</"+Type+">";
}
if (document.selection) {
myField.focus();

//in effect we are creating a text range with zero
//length at the cursor location and replacing it
//with myValue

sel = document.selection.createRange();
sel.text = myValue;
}

//Mozilla/Firefox/Netscape 7+ support
else if (myField.selectionStart || myField.selectionStart == '0') {

//Here we get the start and end points of the
//selection. Then we create substrings up to the
//start of the selection and from the end point
//of the selection to the end of the field value.
//Then we concatenate the first substring, myValue,
//and the second substring to get the new value.
var startPos = myField.selectionStart;
var endPos = myField.selectionEnd;
myField.value = myField.value.substring(0, startPos)+ myValue+ myField.value.substring(endPos, myField.value.length);
} else {
myField.value += myValue;
}
} 
}function submitContent(form, pid)
{
		xmlHttp=GetXmlHttpObject()
		
		if (xmlHttp==null)
		{
				alert ("Browser does not support HTTP Request")
				return
		} 	
		
		
		var url="/admin/webpages/updatecontent.php";
		strb="content="+form+"&pid="+pid;
		
		xmlHttp.onreadystatechange=stateChangeLoadWindow
		xmlHttp.open("POST",url,true);
		xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
		xmlHttp.send(strb);	
		
} 
function stateChangeLoadWindow() 
{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
			window.location.reload();
		} 
} function previewContent(content)
{

document.getElementById("mainContent").innerHTML=content;
}function changePageInfo(id)
{
		xmlHttp=GetXmlHttpObject()
		
		if (xmlHttp==null)
		{
				alert ("Browser does not support HTTP Request")
				return
		} 	
		
		
		var url="/admin/webpages/getpageinfooption.php";
		strb="id="+id;
		xmlHttp.onreadystatechange=stateChangePageInfo
		xmlHttp.open("POST",url,true);
		xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
		xmlHttp.send(strb);	
	
		
} 

function stateChangePageInfo() 
{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
				document.getElementById("pageInfo").
				innerHTML=xmlHttp.responseText;
		} 
} function addFilename(form)
{
		xmlHttp=GetXmlHttpObject()
		
		if (xmlHttp==null)
		{
				alert ("Browser does not support HTTP Request")
				return
		} 	
		
		
		var url="/admin/webpages/addrowform.php";
		strb="choice="+form.rowType.value+"&PID="+form.pid.value;
		
		xmlHttp.onreadystatechange=stateChangeLoadRowForm
		xmlHttp.open("POST",url,true);
		xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
		xmlHttp.send(strb);	
		
} 
function stateChangeLoadRowForm()
{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
				document.getElementById("rowForm").
				innerHTML=xmlHttp.responseText;
		} 
} function changepage(page)
{
window.location=page; 
}