/*---------- Copyright 2011 Neotek Limited (http://www.neotek.co.nz). All rights reserved. -----------*/
var sSkinPath='';var wSplash;var w=window.screen.width;var h=window.screen.height;function $(id){return document.getElementById(id);}var ProcessingTimeout;function showprocessing(){if(ProcessingTimeout!=null){window.clearTimeout(ProcessingTimeout);}try{$('processing').style['display']="block";}catch(e){}ProcessingTimeout=setTimeout(hideprocessing,5000);try{resetsession();}catch(e){}}function hideprocessing(){window.clearTimeout(ProcessingTimeout);ProcessingTimeout=null;try{$('processing').style.display="none";}catch(e){}}function edit(id){var frame=top.frames['InfoFrame'];if(frame==null){frame=window;}frame.document.location.href='/editor3/editcontent.aspx?id='+id;}function editCat(id){top.frames['InfoFrame'].document.location.href='/editor3/editcontent.aspx?categoryid='+id;}function cancelPropagation(Evnt){try{Evnt.cancelBubble=true;}catch(e){try{Evnt.stopPropagation();}catch(e2){}}}function GetXmlHttpObject(){var objXMLHttp=null;if(typeof XMLHttpRequest!="undefined"){objXMLHttp=new XMLHttpRequest();if(objXMLHttp.overrideMimeType){objXMLHttp.overrideMimeType('text/xml');}}else{if(window.ActiveXObject){objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");}}return objXMLHttp;}function getFormValues(fobj){var str="";var formElem;for(var i=0;i<fobj.elements.length;i++){formElem=fobj.elements[i];switch(formElem.type){case"text":str+=formElem.name+"="+escape(formElem.value)+"&";break;case"checkbox":str+=formElem.name+"="+formElem.checked+"&";break;case"textarea":str+=formElem.name+"="+escape(formElem.value)+"&";break;case"hidden":str+=formElem.name+"="+escape(formElem.value)+"&";break;case"password":str+=formElem.name+"="+escape(formElem.value)+"&";break;case"select-one":str+=formElem.name+"="+formElem.options[formElem.selectedIndex].value+"&";break;}}str=str.substr(0,(str.length-1));return str;}function neotekscript(url,params,callback){try{var xmlHttp=GetXmlHttpObject();if(typeof callback=='undefined'||callback==null){xmlHttp.onreadystatechange=function(){processScript(xmlHttp);};}else{xmlHttp.onreadystatechange=function(){callback(xmlHttp);};}if(typeof params=='undefined'||params==null){xmlHttp.open('GET',url,true);xmlHttp.send(null);}else{xmlHttp.open('POST',url,true);xmlHttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlHttp.setRequestHeader("Content-length",params.length);xmlHttp.setRequestHeader("Connection","close");xmlHttp.send(params);}}catch(e){alert(url+' error:'+e.message);}}function processScript(xmlHttp){if(xmlHttp.readyState==4){if(xmlHttp.status==200){var scripts=xmlHttp.responseXML.getElementsByTagName("scripts")[0];if(scripts!=null){var script='';for(var i=0;i<scripts.childNodes.length;i++){try{if(scripts.childNodes[i].textContent!=null){script=scripts.childNodes[i].textContent;}else{script=scripts.childNodes[i].text;}eval(script);}catch(e){alert(script+e.message);}}}else{alert('Failed to get a response!');}}}}function frameLoaded(frame){hideprocessing();}function showSplash(){showprocessing();}function isEnter(e){e=!!e?e:window.event;return(e.keyCode==13);}function neotekText(url,callback,elementId){try{var xmlHttp=GetXmlHttpObject();xmlHttp.open('GET',url,true);xmlHttp.onreadystatechange=function(){if(xmlHttp.readyState==4){if(xmlHttp.status==200&&callback!=null)if(typeof elementId=='undefined'||elementId==null){callback(xmlHttp.responseText);}else{callback(getInnerHTML(xmlHttp.responseText,elementId));}}};xmlHttp.send(null);}catch(e){alert(e.message);}}function getInnerHTML(html,elementId){try{xmlDoc=new ActiveXObject("Microsoft.XMLDOM");xmlDoc.async="false";xmlDoc.loadXML(html);}catch(e){try{parser=new DOMParser();xmlDoc=parser.parseFromString(html,"text/xml");}catch(e2){alert(e2.message);}}return xmlDoc.getElementById(elementId).innerHTML;}function addoption(control,value,text){var optn=document.createElement("OPTION");optn.text=text;optn.value=value;control.options.add(optn);}function setElementValue(id,value){var control=document.getElementById(id);switch(control.type){case"checkbox":control.checked=value;break;case undefined:control.innerHTML=value;break;case"select-one":for(i=0;i<control.length;i++){if(control[i].value==value){control.selectedIndex=i;}}break;default:control.value=value;break;}}function getElementValue(id){var control=document.getElementById(id);switch(control.type){case"checkbox":return control.checked;break;case"select-one":return control.options[control.selectedIndex].value;break;default:return control.value;break;}}function loadXMLOptions(xmlHttp,control,rootname){if(xmlHttp.readyState==4){if(xmlHttp.status==200){var options=xmlHttp.responseXML.getElementsByTagName(rootname)[0];if(options!=null){var option='';for(var i=0;i<options.childNodes.length;i++){try{if(options.childNodes[i].textContent!=null){option=options.childNodes[i].textContent;}else{option=options.childNodes[i].text;}value=options.childNodes[i].attributes[0].value;addoption(control,value,option);}catch(e){}}}else{alert('Failed to get a response!');}}}}function toggle(showButton,hideButton){var theButton=document.getElementById(hideButton);if(theButton.style.display!="none"){theButton.style.display="none";theButton=document.getElementById(showButton);theButton.style.display="block";}}function toTop(){if(top.document.location.href!=document.location.href){top.document.location.replace(document.location.href);}}function isNumeric(x){var RegEx=/^[-+]?[0-9]*\.?[0-9]+(?:[eE][-+]?[0-9]+)?$/;var result=x.match(RegEx);if(result==null){return false;}else{return true;}}function setText(obj,text){obj.innerHTML=text;}function ResetPassword(){top.frames['InfoFrame'].document.location.href='/public/forgottenPassword.aspx';}var Event={Add:function(obj,evt,func,capture){if(!!!obj)return;if(typeof(func)!='function')return;if(obj.addEventListener)obj.addEventListener(evt,func,capture);else if(obj.attachEvent)obj.attachEvent('on'+evt,func);return;},Remove:function(obj,evt,func,capture){if(!!!obj)return;if(typeof func!='function')return;if(obj.removeEventListener)obj.removeEventListener(evt,func,capture);else if(obj.detachEvent)obj.detachEvent('on'+evt,func);return;},Fire:function(obj,evt){if(obj==null)return;if(obj.fireEvent!=null){obj.fireEvent('on'+evt);}else{var e=document.createEvent('MouseEvents');e.initEvent(evt,false,false);obj.dispatchEvent(e);}},Get:function(e){try{if(!e){e=window.event;}if(e.layerX){e.offsetX=e.layerX;e.offsetY=e.layerY;}if(e.type=='mouseover'&&!e.relatedTarget){e.relatedTarget=e.fromElement;}else if(e.type=='mouseout'&&!e.relatedTarget){e.relatedTarget=e.toElement;}e.src=e.srcElement||e.target;e.key=e.keyCode||e.charCode;return e;}catch(ex){}return null;}};function Querystring(qs){this.params={};if(qs==null)qs=location.search.substring(1,location.search.length);if(qs.length==0)return;qs=qs.replace(/\+/g,' ');var args=qs.split('&');for(var i=0;i<args.length;i++){var pair=args[i].split('=');var name=decodeURIComponent(pair[0]);var value=(pair.length==2)?decodeURIComponent(pair[1]):name;this.params[name]=value;}}Querystring.prototype.get=function(key,default_){var value=this.params[key];return(value!=null)?value:default_;};Querystring.prototype.contains=function(key){var value=this.params[key];return(value!=null);};function ForceFrame(){if(top.InfoFrame==null){window.location.replace('/default.aspx?url='+Url.encode(top.document.location.href));}}var Url={encode:function(string){return escape(this._utf8_encode(string));},decode:function(string){return this._utf8_decode(unescape(string));},_utf8_encode:function(string){string=string.replace(/\r\n/g,"\n");var utftext="";for(var n=0;n<string.length;n++){var c=string.charCodeAt(n);if(c<128){utftext+=String.fromCharCode(c);}else if((c>127)&&(c<2048)){utftext+=String.fromCharCode((c>>6)|192);utftext+=String.fromCharCode((c&63)|128);}else{utftext+=String.fromCharCode((c>>12)|224);utftext+=String.fromCharCode(((c>>6)&63)|128);utftext+=String.fromCharCode((c&63)|128);}}return utftext;},_utf8_decode:function(utftext){var string="";var i=0;var c=c1=c2=0;while(i<utftext.length){c=utftext.charCodeAt(i);if(c<128){string+=String.fromCharCode(c);i++;}else if((c>191)&&(c<224)){c2=utftext.charCodeAt(i+1);string+=String.fromCharCode(((c&31)<<6)|(c2&63));i+=2;}else{c2=utftext.charCodeAt(i+1);c3=utftext.charCodeAt(i+2);string+=String.fromCharCode(((c&15)<<12)|((c2&63)<<6)|(c3&63));i+=3;}}return string;}};try{top.hideprocessing();}catch(e){}
