
var bustcachevar=1
var loadedobjects=""
var rootdomain="http://"+window.location.hostname
var bustcacheparameter=""
var http_request=false;var loadstatustext="<img src='imgs/loading.gif' /> Requesting content..."
function pages(urls,containerid){var page_request=false
var con=urls+"&div="+containerid
if(window.XMLHttpRequest)
page_request=new XMLHttpRequest()
else if(window.ActiveXObject){try{page_request=new ActiveXObject("Msxml2.XMLHTTP")}
catch(e){try{page_request=new ActiveXObject("Microsoft.XMLHTTP")}
catch(e){}}}
else
return false
document.getElementById(containerid).innerHTML=loadstatustext
page_request.onreadystatechange=function(){loadpage(page_request,containerid)}
if(bustcachevar)
bustcacheparameter=(con.indexOf("?")!=-1)?"&"+new Date().getTime():"?"+new Date().getTime()
page_request.open('GET',con+bustcacheparameter,true)
page_request.send(null)}
function loadpage(page_request,containerid){if(page_request.readyState==4&&(page_request.status==200||window.location.href.indexOf("http")==-1))
document.getElementById(containerid).innerHTML=page_request.responseText}
function loadobjs(){if(!document.getElementById)
return
for(i=0;i<arguments.length;i++){var file=arguments[i]
var fileref=""
if(loadedobjects.indexOf(file)==-1){if(file.indexOf(".js")!=-1){fileref=document.createElement('script')
fileref.setAttribute("type","text/javascript");fileref.setAttribute("src",file);}
else if(file.indexOf(".css")!=-1){fileref=document.createElement("link")
fileref.setAttribute("rel","stylesheet");fileref.setAttribute("type","text/css");fileref.setAttribute("href",file);}}
if(fileref!=""){document.getElementsByTagName("head").item(0).appendChild(fileref)
loadedobjects+=file+" "}}}
function makePOSTRequest(url,parameters){http_request=false;if(window.XMLHttpRequest){http_request=new XMLHttpRequest();if(http_request.overrideMimeType){http_request.overrideMimeType('text/html');}}else if(window.ActiveXObject){try{http_request=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{http_request=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){}}}
if(!http_request){alert('Cannot create XMLHTTP instance');return false;}
http_request.onreadystatechange=alertContents;http_request.open('POST',url,true);http_request.setRequestHeader("Content-type","application/x-www-form-urlencoded");http_request.setRequestHeader("Content-length",parameters.length);http_request.setRequestHeader("Connection","close");http_request.send(parameters);}
function getstate(url,parameters,container){http_request=false;if(window.XMLHttpRequest){http_request=new XMLHttpRequest();if(http_request.overrideMimeType){http_request.overrideMimeType('text/html');}}else if(window.ActiveXObject){try{http_request=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{http_request=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){}}}
if(!http_request){alert('Cannot create XMLHTTP instance');return false;}
http_request.onreadystatechange=container;http_request.open('POST',url,true);http_request.setRequestHeader("Content-type","application/x-www-form-urlencoded");http_request.setRequestHeader("Content-length",parameters.length);http_request.setRequestHeader("Connection","close");http_request.send(parameters);}
function returnSubCategories(){if(http_request.readyState==4){if(http_request.status==200){result=http_request.responseText;document.getElementById('subCategoryList').innerHTML=result;}else{alert('There was a problem with the request.');}}}
function getSubcategories(obj){if(window.document.getElementById("browsing"))
browse=window.document.getElementById("browsing").value;else
browse='';var poststra="cateCategoryId="+encodeURI(window.document.getElementById("categoryList").value)+"&subCategoryId="+encodeURI(window.document.getElementById("subCategoryId").value)+"&browsing="+encodeURI(window.document.getElementById("browsing").value);getstate('/ajax.php',poststra,returnSubCategories);}
function returnSubCategoriesRef(){if(http_request.readyState==4){if(http_request.status==200){result=http_request.responseText;document.getElementById('subCategoryListRef').innerHTML=result;}else{alert('There was a problem with the request.');}}}
function getSubcategoriesRef(obj){if(window.document.getElementById("browsing"))
browse=window.document.getElementById("browsing").value;else
browse='';var poststra="cateCategoryId="+encodeURI(window.document.getElementById("categoryListRef").value)+"&subCategoryId="+encodeURI(window.document.getElementById("subCategoryId").value)+"&browsing=subCategoryListRefs";getstate('/ajax.php',poststra,returnSubCategoriesRef);}
function returnXRefs(){if(http_request.readyState==4){if(http_request.status==200){result=http_request.responseText;document.getElementById('displayXRefs').innerHTML=result;}else{alert('There was a problem with the request.');}}}
function addXRefs(obj){var poststra="trcaCategoryId="+encodeURI(window.document.getElementById("categoryListRef").value)+"&trcaSubCategoryId="+encodeURI(window.document.getElementById("subCategoryListRefs").value)+"&trcaTrackId="+encodeURI(window.document.getElementById("tracTrackId").value);getstate('/admin/index/catToTrack',poststra,returnXRefs);}
function deleteXRefs(obj){var poststra="trcaTrackCategoryId="+encodeURI(obj.id)+"&trcaTrackId="+encodeURI(window.document.getElementById("tracTrackId").value);getstate('/admin/index/catToTrack',poststra,returnXRefs);}