
var jx=(new Skava_Http_class()).jax;function Skava_Http_class()
{this.jax={http:false,format:'text',callback:function(data){},error:function(err){alert(err);},getHTTPObject:function()
{var http=false;if(typeof ActiveXObject!='undefined')
{try
{http=new ActiveXObject("Msxml2.XMLHTTP");}
catch(e)
{try
{http=new ActiveXObject("Microsoft.XMLHTTP");}
catch(E)
{http=false;}}}
else if(XMLHttpRequest)
{try
{http=new XMLHttpRequest();}
catch(e)
{http=false;}}
return http;},load:function(url,callback,format,method,errcallback,body)
{this.init();if(!this.http||!url)
return;if(!method)
{method="GET";}
this.callback=callback;if(!format)format="text/xml";this.format=format.toLowerCase();var ths=this;var now="uid="+new Date().getTime();url+=(url.indexOf("?")+1)?"&":"?";url+=now;this.http.open(method,url,true);this.http.onreadystatechange=function()
{if(!ths)return;var http=ths.http;if(http.readyState==4)
{var NETWORK_ERROR="Please check your network connection and try again.";var httpStatus=0;var httpStatusText="";try
{httpStatus=((typeof(http.status)=="undefined"||!http.status)?500:http.status);httpStatusText=((typeof(http.statusText)=="undefined"||!http.statusText||http.statusText=="Unknown")?NETWORK_ERROR:http.statusText);}
catch(e)
{httpStatus=500;httpStatusText=NETWORK_ERROR;}
if(httpStatus==200)
{var result="";if(http.responseText)result=http.responseText;if(ths.format.charAt(0)=="j")
{result=result.replace(/[\n\r]/g,"");result=eval('('+result+')');}
if(ths.callback)ths.callback(result,http);}
else
{if(errcallback)
{errcallback(httpStatus,httpStatusText);}
else if(ths.error)
{ths.error(httpStatus+" "+httpStatusText+" for url "+url+" and method "+method);}}}}
if(method=="POST")
{this.http.setRequestHeader("Content-Type",this.format);}
this.http.send((body)?body:null);},init:function()
{this.http=this.getHTTPObject();}}}
Skava_Http_class.prototype.jax;function doAWSUpload(idForm,url,errorCallback)
{var form=document.getElementById(idForm);url=url+"&"+urlEncode({file:form.file.value})+"&transport=direct";var afterUpload=function(result)
{if(result.jsonerror)
{if(errorCallback)
{errorCallback(0,result.jsonerror);}
else
{alert(result.jsonerror);}}
else
{form.key.value=result.key;form.AWSAccessKeyId.value=result.AWSAccessKeyId;form.acl.value=result.acl;form.success_action_redirect.value=result.success_action_redirect;form.policy.value=result.policy;form.signature.value=result.signature;form['Content-Type'].value=result['Content-Type'];var isIE=window.ActiveXObject?true:false;{var idx=result.action.indexOf("https:");if(idx==0)
{result.action="http:"+result.action.substring(6);}}
form.action=result.action;form.submit();}}
if(errorCallback)
{jx.load(url,afterUpload,"json","GET",errorCallback);}
else
{jx.load(url,afterUpload,"json");}}
function createDelegate(fn,scope,args)
{var fnDelegate=function()
{fn.apply(scope,args);}
return fnDelegate;}
function toPost(getString,newTab)
{var parms=getString.split('?');var newF=document.createElement("form");newF.action=parms[0];newF.method='POST';if(newTab)
{newF.target="_blank";}
var parms=parms[1].split('&');for(var i=0;i<parms.length;i++)
{var pos=parms[i].indexOf('=');if(pos>0)
{var key=parms[i].substring(0,pos);var val=parms[i].substring(pos+1);var newH=document.createElement("input");newH.name=key;newH.type='hidden';newH.value=unescape(val);newF.appendChild(newH);}}
document.getElementsByTagName('body')[0].appendChild(newF);newF.submit();}
function getDataFromServer(id,url)
{var oScript=document.getElementById(id);var head=document.getElementsByTagName("head").item(0);if(oScript)
{head.removeChild(oScript);}
oScript=document.createElement("script");oScript.type='text/javascript';oScript.src=url;if(id)
{oScript.id=id;}
head.appendChild(oScript);}