document.write("<scr" + "ipt src='js/prototype.js' language='javascript'></scr" + "ipt>");

function check()
{	
	// result of check license code
	var chkResult = false;
	
	var regcode = Trim(document.all.sn.value);
	
	var preurl = "http://www.foxeasy.com/fox_flash_decompiler/js/";
	var okurl = "https://sshop.element5.com/esales/checkout.html?productid=300253118&language=English";
	var falseurl = "sn_wrong.htm";
	
	new Ajax.Request(preurl + 'checkup.php?code=' + regcode, 
	{
  		onComplete: function(transport) 
  		{
  			//alert('finish');
    		if (200 == transport.status)
    		{
    			if(transport.responseText == 'valid')
    			{
    				//alert('true');
    				chkResult = true;
    				window.location.href=okurl;
    			}
    			else
    			{	
    			//alert(transport.responseText);
    			chkResult = false;
    			window.location.href=falseurl;
    			}
    		}
    		else
    		{
    			//alert(transport.responseText);
    			chkResult = false;
    			window.location.href=falseurl;
    		}
		},
		
		onException: function(transport) 
		{
			alert('ex');
			chkResult = false;
			window.location.href=falseurl;
		},
		
		onFailure: function(transport) 
		{
			alert('fail');
			chkResult = false;
			window.location.href="sn_wrong.htm";
		}
	});
}
function Trim(InString) {

   strLen = InString.length;
   if(strLen==0) 
        OutString = InString;
   else {
       i=0;
       while ( InString.charAt(i) == " ") {
          i++;
       }
       j=strLen-1;
       while ( InString.charAt(j) == " ") {
          j--;
       }
       if(strLen==i)
        OutString = "";
       else
        OutString = InString.substring(i,j+1);
   }
   return OutString;
}
