﻿// JScript File


function Left(str, n){
          if (n <= 0)
              return "";
          else if (n > String(str).length)
              return str;
          else
              return String(str).substring(0,n);
}
        

function Right(str, n){
          if (n <= 0)
             return "";
          else if (n > String(str).length)
             return str;
          else {
             var iLen = String(str).length;
             return String(str).substring(iLen, iLen - n);
              }
}
        

function createrequest(){

    var req;

    try{

        req = new XMLHttpRequest();

    }

    catch(e)

    {

        try{

                      req = new ActiveXObject("Msxml2.XMLHTTP");

               } 

               catch (e) 

               {

                try{

                            req = new ActiveXObject("Microsoft.XMLHTTP");

                      } 

                      catch (e)

                      {

                            // Something went wrong

                           //alert("Sorry Your Browser may not support AJAX Content You Need To Have IE5 Or Above");

                            //return false;

                            //return true;

                        }

                }

    }

    return req;

}





function popup(URL){
        
            window.open(URL),"Large Image","width=300,height=300,toolbar=0,scrollbars=auto,location=0,status=0,menubar=0,resizeable=yes"
            
            }



function sendreminder(form){

var oldlogin = form.oldlogin.value;

var ajaxRequest = createrequest();  // The variable that makes Ajax possible!
document.body.style.cursor="wait";

	// Create a function that will receive data sent from the server
	
    function handleresponse(){
		if(ajaxRequest.readyState == 4 && ajaxRequest.status == 200){
		    var response = ajaxRequest.responseText;
		    //alert(response);
		    response=response.substring(0,response.indexOf("<!DOCTYPE")-4);
        
            if(response=="")
            {
                window.location.reload();
            }
            else
            {
                var arr=response.split("~")
                
                for(var i=0;i<arr.length;i++)
                {
                    var table = arr[i].split("|");
                    var tablestring = table[0];
                    var intstring = table[1];
                    if (tablestring == "item1"){
                        document.getElementById('sendremindertext').innerHTML=intstring;
                    }
                }
			 }
			document.body.style.cursor="default"; 
			return true;
		}
		else
		{
			return false;
		}
		document.body.style.cursor="default";
    }
    myRand=parseInt(Math.random()*99999999);    
    var url = "revajax.aspx?com=sendreminder&oldlogin=" + oldlogin + "&rnd=" + myRand;
	ajaxRequest.open("GET", url, true);
	ajaxRequest.onreadystatechange = handleresponse;
	ajaxRequest.send(null);
}
function adminlogin(form){

var adminpassword = form.adminpassword.value;
var correctpassword = "NO";
var adminlogin = "";
var winURL = "homepage.aspx?com=admin&adminlogin=";

var ajaxRequest = createrequest();  // The variable that makes Ajax possible!
document.body.style.cursor="wait";

	// Create a function that will receive data sent from the server
	
    function handleresponse(){
		if(ajaxRequest.readyState == 4 && ajaxRequest.status == 200){
		    var response = ajaxRequest.responseText;
		    //alert(response);
		    response=response.substring(0,response.indexOf("<!DOCTYPE")-4);
        
            if(response=="")
            {
                window.location.reload();
            }
            else
            {
                var arr=response.split("~")
                
                for(var i=0;i<arr.length;i++)
                {
                    var table = arr[i].split("|");
                    var tablestring = table[0];
                    var intstring = table[1];
                    if (tablestring == "item1"){
                        correctpassword=intstring;
                    }
                    if (tablestring == "item2"){
                        adminlogin=intstring;
                    }
                    if (tablestring == "item3"){
                        adminlogin=adminlogin + intstring;
                    }
                }
                
                //
                if (correctpassword == "YES")    {
               winURL = winURL + adminlogin
                
                window.location.replace(winURL);
       
			    return true;
                }
                
                
			 }
			document.body.style.cursor="default"; 
			return true;
		}
		else
		{
			return false;
		}
		document.body.style.cursor="default";
    }
    myRand=parseInt(Math.random()*99999999);    
    var url = "revajax.aspx?com=adminlogin&adminpassword=" + adminpassword + "&rnd=" + myRand;
	ajaxRequest.open("GET", url, true);
	ajaxRequest.onreadystatechange = handleresponse;
	ajaxRequest.send(null);
}

function newadminlogin(form){

var adminpassword = form.adminpassword.value;

var adminemail = form.adminemail.value;
var winURL = "homepage.aspx?com=admin&adminlogin=";

var ajaxRequest = createrequest();  // The variable that makes Ajax possible!
document.body.style.cursor="wait";

	// Create a function that will receive data sent from the server
	
    function handleresponse(){
		if(ajaxRequest.readyState == 4 && ajaxRequest.status == 200){
		    var response = ajaxRequest.responseText;
		    //alert(response);
		    response=response.substring(0,response.indexOf("<!DOCTYPE")-4);
        
            if(response=="")
            {
                window.location.reload();
            }
            else
            {
                var arr=response.split("~")
                
                for(var i=0;i<arr.length;i++)
                {
                    var table = arr[i].split("|");
                    var tablestring = table[0];
                    var intstring = table[1];
                    if (tablestring == "item1"){
                        correctpassword=intstring;
                    }
                    if (tablestring == "item2"){
                        adminlogin=intstring;
                    }
                    if (tablestring == "item3"){
                        adminlogin=adminlogin + intstring;
                    }
                    if (tablestring == "item4"){
                        document.getElementById('loginerrormessage').innerHTML=intstring; 
                    }
                }
                
                //
                if (correctpassword == "YES")    {
               winURL = winURL + adminlogin
                
                window.location.replace(winURL);
       
			    return true;
                }
                
                
			 }
			document.body.style.cursor="default"; 
			return true;
		}
		else
		{
			return false;
		}
		document.body.style.cursor="default";
    }
    myRand=parseInt(Math.random()*99999999);    
    var url = "revajax.aspx?com=newadminlogin&adminpassword=" + adminpassword + "&adminemail=" + adminemail + "&rnd=" + myRand;
	ajaxRequest.open("GET", url, true);
	ajaxRequest.onreadystatechange = handleresponse;
	ajaxRequest.send(null);
}
function admincontinue(form){
	    
	    
	    
        var winURL = "homepage.aspx?com=admin&infotype=3";
        //if ( srch == "Search Text"){
    
        //}else{
           window.location.replace(winURL);
        //}
	
}

function addreview(form){

var reviewcust = form.reviewcust.value;
var reviewnotes = form.reviewnotes.value;
var reviewstars = form.reviewstars.value;
var reviewtown = form.reviewtown.value;
var reviewaboutyou = form.reviewaboutyou.value;

var prodcode = form.prodcode.value;
var webcode = form.webcode.value;
var tablecode = form.tablecode.value;
var revlanguage = form.revlanguage.value;
var ajaxRequest = createrequest();  // The variable that makes Ajax possible!
document.body.style.cursor="wait";

	// Create a function that will receive data sent from the server
	
    function handleresponse(){
		if(ajaxRequest.readyState == 4 && ajaxRequest.status == 200){
		    var response = ajaxRequest.responseText;
		    //alert(response);
		    response=response.substring(0,response.indexOf("<!DOCTYPE")-4);
        
            if(response=="")
            {
                window.location.reload();
            }
            else
            {
                var arr=response.split("~")
                
                for(var i=0;i<arr.length;i++)
                {
                    var table = arr[i].split("|");
                    var tablestring = table[0];
                    var intstring = table[1];
                    if (tablestring == "thankyoumessage"){
                    document.getElementById('thankyoumessage').innerHTML=intstring;                    			        
			        }
                    if (tablestring == "reviewform"){
                    document.getElementById('reviewform').innerHTML=intstring;                    			        
			        }
                    
                    
                }
			 }
			document.body.style.cursor="default"; 
			return true;
		}
		else
		{
			return false;
		}
		document.body.style.cursor="default";
    }
    myRand=parseInt(Math.random()*99999999);    
    var url = "revajax.aspx?com=addreview&reviewcust=" + reviewcust + "&revlanguage=" + revlanguage + "&reviewnotes=" + reviewnotes
    url = url + "&reviewtown=" + reviewtown+ "&reviewaboutyou=" + reviewaboutyou
    url = url + "&reviewstars=" + reviewstars+ "&prodcode=" + prodcode + "&webcode=" + webcode  + "&tablecode=" + tablecode + "&rnd=" + myRand;
	ajaxRequest.open("GET", url, true);
	ajaxRequest.onreadystatechange = handleresponse;
	ajaxRequest.send(null);
}
function updateadminreviewtext(reviewtext, reviewid, prodcode, webcode, revlanguage){


var ajaxRequest = createrequest();  // The variable that makes Ajax possible!
document.body.style.cursor="wait";

	// Create a function that will receive data sent from the server
	
    function handleresponse(){
		if(ajaxRequest.readyState == 4 && ajaxRequest.status == 200){
		    var response = ajaxRequest.responseText;
		    //alert(response);
		    response=response.substring(0,response.indexOf("<!DOCTYPE")-4);
        
            if(response=="")
            {
                window.location.reload();
            }
            else
            {
                var arr=response.split("~")
                
                for(var i=0;i<arr.length;i++)
                {
                    var table = arr[i].split("|");
                    var tablestring = table[0];
                    var intstring = table[1];
                    
                }
			 }
			document.body.style.cursor="default"; 
			return true;
		}
		else
		{
			return false;
		}
		document.body.style.cursor="default";
    }
    myRand=parseInt(Math.random()*99999999);    
    var url = "revajax.aspx?com=updateadminreviewtext&revlanguage=" + revlanguage + "&reviewtext=" + reviewtext;
    
    
    url = url + "&prodcode=" + prodcode + "&webcode=" + webcode  + "&rnd=" + myRand;
	ajaxRequest.open("GET", url, true);
	ajaxRequest.onreadystatechange = handleresponse;
	ajaxRequest.send(null);
}

function updateadminreviewfeature(feature, featureno, prodcode, webcode, revlanguage){


var ajaxRequest = createrequest();  // The variable that makes Ajax possible!
document.body.style.cursor="wait";

	// Create a function that will receive data sent from the server
	
    function handleresponse(){
		if(ajaxRequest.readyState == 4 && ajaxRequest.status == 200){
		    var response = ajaxRequest.responseText;
		    //alert(response);
		    response=response.substring(0,response.indexOf("<!DOCTYPE")-4);
        
            if(response=="")
            {
                window.location.reload();
            }
            else
            {
                var arr=response.split("~")
                
                for(var i=0;i<arr.length;i++)
                {
                    var table = arr[i].split("|");
                    var tablestring = table[0];
                    var intstring = table[1];
                    
                }
			 }
			document.body.style.cursor="default"; 
			return true;
		}
		else
		{
			return false;
		}
		document.body.style.cursor="default";
    }
    myRand=parseInt(Math.random()*99999999);    
    var url = "revajax.aspx?com=updateadminreviewfeature&revlanguage=" + revlanguage + "&feature=" + feature;
    url = url + "&featureno=" + featureno;
    
    url = url + "&prodcode=" + prodcode + "&webcode=" + webcode  + "&rnd=" + myRand;
	ajaxRequest.open("GET", url, true);
	ajaxRequest.onreadystatechange = handleresponse;
	ajaxRequest.send(null);
}



function updatereviewsort(form){

var reviewsort = form.reviewsort.value;
var prodcode = form.prodcode.value;
var webcode = form.webcode.value;
var tablecode = form.tablecode.value;
var ajaxRequest = createrequest();  // The variable that makes Ajax possible!
document.body.style.cursor="wait";

	// Create a function that will receive data sent from the server
	
    function handleresponse(){
		if(ajaxRequest.readyState == 4 && ajaxRequest.status == 200){
		    var response = ajaxRequest.responseText;
		    //alert(response);
		    response=response.substring(0,response.indexOf("<!DOCTYPE")-4);
        
            if(response=="")
            {
                window.location.reload();
            }
            else
            {
                var arr=response.split("~")
                
                for(var i=0;i<arr.length;i++)
                {
                    var table = arr[i].split("|");
                    var tablestring = table[0];
                    var intstring = table[1];
                    if (tablestring == "reviewsinnerstring"){
                    document.getElementById('reviewsinnerstring').innerHTML=intstring;                    			        
			        }
                    
                }
			 }
			document.body.style.cursor="default"; 
			return true;
		}
		else
		{
			return false;
		}
		document.body.style.cursor="default";
    }
    myRand=parseInt(Math.random()*99999999);    
    var url = "revajax.aspx?com=updatereviewsort&reviewsort=" + reviewsort +  "&prodcode=" + prodcode + "&webcode=" + webcode +  "&tablecode=" + tablecode + "&rnd=" + myRand;
	ajaxRequest.open("GET", url, true);
	ajaxRequest.onreadystatechange = handleresponse;
	ajaxRequest.send(null);
}

function custreviewsort(form){

var reviewsort = form.reviewsort.value;
var reviewexamined = form.reviewexamined.value;
var whichproducts = form.whichproducts.value;
var revlanguage = form.revlanguage.value;

var ajaxRequest = createrequest();  // The variable that makes Ajax possible!
document.body.style.cursor="wait";

	// Create a function that will receive data sent from the server
	
    function handleresponse(){
		if(ajaxRequest.readyState == 4 && ajaxRequest.status == 200){
		    var response = ajaxRequest.responseText;
		    //alert(response);
		    response=response.substring(0,response.indexOf("<!DOCTYPE")-4);
        
            if(response=="")
            {
                window.location.reload();
            }
            else
            {
                var arr=response.split("~")
                
                for(var i=0;i<arr.length;i++)
                {
                    var table = arr[i].split("|");
                    var tablestring = table[0];
                    var intstring = table[1];
                    if (tablestring == "sortedreviews"){
                    document.getElementById('sortedreviews').innerHTML=intstring;                    			        
			        }
			        if (tablestring == "custreviewsinnerstring"){
                    document.getElementById('custreviewsinnerstring').innerHTML=intstring;                    			        
			        }
                    
                }
			 }
			document.body.style.cursor="default"; 
			return true;
		}
		else
		{
			return false;
		}
		document.body.style.cursor="default";
    }
    myRand=parseInt(Math.random()*99999999);    
    var url = "revajax.aspx?com=custreviewsort&reviewsort=" + reviewsort +  "&revlanguage=" + revlanguage +  "&reviewexamined=" + reviewexamined +  "&whichproducts=" + whichproducts + "&rnd=" + myRand;
	ajaxRequest.open("GET", url, true);
	ajaxRequest.onreadystatechange = handleresponse;
	ajaxRequest.send(null);
}
function updatereviewflag(showflag, reviewid){


var ajaxRequest = createrequest();  // The variable that makes Ajax possible!
document.body.style.cursor="wait";

	// Create a function that will receive data sent from the server
	
    function handleresponse(){
		if(ajaxRequest.readyState == 4 && ajaxRequest.status == 200){
		    var response = ajaxRequest.responseText;
		    //alert(response);
		    response=response.substring(0,response.indexOf("<!DOCTYPE")-4);
        
            if(response=="")
            {
                window.location.reload();
            }
            else
            {
                var arr=response.split("~")
                
                for(var i=0;i<arr.length;i++)
                {
                    var table = arr[i].split("|");
                    var tablestring = table[0];
                    var intstring = table[1];
                   
                    
                }
			 }
			document.body.style.cursor="default"; 
			return true;
		}
		else
		{
			return false;
		}
		document.body.style.cursor="default";
    }
    myRand=parseInt(Math.random()*99999999);    
    var url = "revajax.aspx?com=updatereviewflag&reviewid=" + reviewid + "&showflag=" + showflag + "&rnd=" + myRand;
	ajaxRequest.open("GET", url, true);
	ajaxRequest.onreadystatechange = handleresponse;
	ajaxRequest.send(null);
}
function updateadminreviewflag(form, reviewid){

var showflag = form.reviewshowflag.value;
    
var ajaxRequest = createrequest();  // The variable that makes Ajax possible!
document.body.style.cursor="wait";

	// Create a function that will receive data sent from the server
	
    function handleresponse(){
		if(ajaxRequest.readyState == 4 && ajaxRequest.status == 200){
		    var response = ajaxRequest.responseText;
		    //alert(response);
		    response=response.substring(0,response.indexOf("<!DOCTYPE")-4);
        
            if(response=="")
            {
                window.location.reload();
            }
            else
            {
                var arr=response.split("~")
                
                for(var i=0;i<arr.length;i++)
                {
                    var table = arr[i].split("|");
                    var tablestring = table[0];
                    var intstring = table[1];
                   
                    
                }
			 }
			document.body.style.cursor="default"; 
			return true;
		}
		else
		{
			return false;
		}
		document.body.style.cursor="default";
    }
    myRand=parseInt(Math.random()*99999999);    
    var url = "revajax.aspx?com=updateadminreviewflag&reviewid=" + reviewid + "&showflag=" + showflag + "&rnd=" + myRand;
	ajaxRequest.open("GET", url, true);
	ajaxRequest.onreadystatechange = handleresponse;
	ajaxRequest.send(null);
}
function updaterevexamined(revexamined, reviewid){


    
var ajaxRequest = createrequest();  // The variable that makes Ajax possible!
document.body.style.cursor="wait";

	// Create a function that will receive data sent from the server
	
    function handleresponse(){
		if(ajaxRequest.readyState == 4 && ajaxRequest.status == 200){
		    var response = ajaxRequest.responseText;
		    //alert(response);
		    response=response.substring(0,response.indexOf("<!DOCTYPE")-4);
        
            if(response=="")
            {
                window.location.reload();
            }
            else
            {
                var arr=response.split("~")
                
                for(var i=0;i<arr.length;i++)
                {
                    var table = arr[i].split("|");
                    var tablestring = table[0];
                    var intstring = table[1];
                   
                    
                }
			 }
			document.body.style.cursor="default"; 
			return true;
		}
		else
		{
			return false;
		}
		document.body.style.cursor="default";
    }
    myRand=parseInt(Math.random()*99999999);    
    var url = "revajax.aspx?com=updaterevexamined&reviewid=" + reviewid + "&revexamined=" + revexamined + "&rnd=" + myRand;
	ajaxRequest.open("GET", url, true);
	ajaxRequest.onreadystatechange = handleresponse;
	ajaxRequest.send(null);
}




function deletecustreview(deleteflag, reviewid){


    
var ajaxRequest = createrequest();  // The variable that makes Ajax possible!
document.body.style.cursor="wait";

	// Create a function that will receive data sent from the server
	
    function handleresponse(){
		if(ajaxRequest.readyState == 4 && ajaxRequest.status == 200){
		    var response = ajaxRequest.responseText;
		    //alert(response);
		    response=response.substring(0,response.indexOf("<!DOCTYPE")-4);
        
            if(response=="")
            {
                window.location.reload();
            }
            else
            {
                var arr=response.split("~")
                
                for(var i=0;i<arr.length;i++)
                {
                    var table = arr[i].split("|");
                    var tablestring = table[0];
                    var intstring = table[1];
                   
                    
                }
			 }
			document.body.style.cursor="default"; 
			return true;
		}
		else
		{
			return false;
		}
		document.body.style.cursor="default";
    }
    myRand=parseInt(Math.random()*99999999);    
    var url = "revajax.aspx?com=deletereview&reviewid=" + reviewid + "&deleteflag=" + deleteflag + "&rnd=" + myRand;
	ajaxRequest.open("GET", url, true);
	ajaxRequest.onreadystatechange = handleresponse;
	ajaxRequest.send(null);
}



function updateadminrevexamined(form, reviewid){

var revexamined = form.changerevexamined.value;
    
var ajaxRequest = createrequest();  // The variable that makes Ajax possible!
document.body.style.cursor="wait";

	// Create a function that will receive data sent from the server
	
    function handleresponse(){
		if(ajaxRequest.readyState == 4 && ajaxRequest.status == 200){
		    var response = ajaxRequest.responseText;
		    //alert(response);
		    response=response.substring(0,response.indexOf("<!DOCTYPE")-4);
        
            if(response=="")
            {
                window.location.reload();
            }
            else
            {
                var arr=response.split("~")
                
                for(var i=0;i<arr.length;i++)
                {
                    var table = arr[i].split("|");
                    var tablestring = table[0];
                    var intstring = table[1];
                   
                    
                }
			 }
			document.body.style.cursor="default"; 
			return true;
		}
		else
		{
			return false;
		}
		document.body.style.cursor="default";
    }
    myRand=parseInt(Math.random()*99999999);    
    var url = "revajax.aspx?com=updateadminrevexamined&reviewid=" + reviewid + "&revexamined=" + revexamined + "&rnd=" + myRand;
	ajaxRequest.open("GET", url, true);
	ajaxRequest.onreadystatechange = handleresponse;
	ajaxRequest.send(null);
}
 function updaterevtext(revtext, reviewid){


var ajaxRequest = createrequest();  // The variable that makes Ajax possible!
document.body.style.cursor="wait";

	// Create a function that will receive data sent from the server
	
    function handleresponse(){
		if(ajaxRequest.readyState == 4 && ajaxRequest.status == 200){
		    var response = ajaxRequest.responseText;
		    //alert(response);
		    response=response.substring(0,response.indexOf("<!DOCTYPE")-4);
        
            if(response=="")
            {
                window.location.reload();
            }
            else
            {
                var arr=response.split("~")
                
                for(var i=0;i<arr.length;i++)
                {
                    var table = arr[i].split("|");
                    var tablestring = table[0];
                    var intstring = table[1];
                   
                    
                }
			 }
			document.body.style.cursor="default"; 
			return true;
		}
		else
		{
			return false;
		}
		document.body.style.cursor="default";
    }
    myRand=parseInt(Math.random()*99999999);    
    var url = "revajax.aspx?com=updaterevtext&reviewid=" + reviewid + "&revtext=" + revtext + "&rnd=" + myRand;
	ajaxRequest.open("GET", url, true);
	ajaxRequest.onreadystatechange = handleresponse;
	ajaxRequest.send(null);
}
     
function adminreviewsort(form){

var revlanguage = form.whichlanguage.value;
var reviewexamined = form.reviewexamined.value;
var whichsection = form.whichsection.value;


var ajaxRequest = createrequest();  // The variable that makes Ajax possible!
document.body.style.cursor="wait";

	// Create a function that will receive data sent from the server
	
    function handleresponse(){
		if(ajaxRequest.readyState == 4 && ajaxRequest.status == 200){
		    var response = ajaxRequest.responseText;
		    //alert(response);
		    response=response.substring(0,response.indexOf("<!DOCTYPE")-4);
        
            if(response=="")
            {
                window.location.reload();
            }
            else
            {
                var arr=response.split("~")
                
                for(var i=0;i<arr.length;i++)
                {
                    var table = arr[i].split("|");
                    var tablestring = table[0];
                    var intstring = table[1];
                    if (tablestring == "adminreviewinner"){
                    document.getElementById('adminreviewinner').innerHTML=intstring;                    			        
			        }
                    
                }
			 }
			document.body.style.cursor="default"; 
			return true;
		}
		else
		{
			return false;
		}
		document.body.style.cursor="default";
    }
    myRand=parseInt(Math.random()*99999999);    
    var url = "revajax.aspx?com=adminreviewsort&revlanguage=" + revlanguage +  "&reviewexamined=" + reviewexamined +  "&whichsection=" + whichsection + "&rnd=" + myRand;
	ajaxRequest.open("GET", url, true);
	ajaxRequest.onreadystatechange = handleresponse;
	ajaxRequest.send(null);
}

function adminpricessort(form){

var pricelist = form.whichpricelist.value;
var whichdepot = form.whichdepot.value;
var whichsection = form.whichsection.value;


var ajaxRequest = createrequest();  // The variable that makes Ajax possible!
document.body.style.cursor="wait";

	// Create a function that will receive data sent from the server
	
    function handleresponse(){
		if(ajaxRequest.readyState == 4 && ajaxRequest.status == 200){
		    var response = ajaxRequest.responseText;
		    //alert(response);
		    response=response.substring(0,response.indexOf("<!DOCTYPE")-4);
        
            if(response=="")
            {
                window.location.reload();
            }
            else
            {
                var arr=response.split("~")
                
                for(var i=0;i<arr.length;i++)
                {
                    var table = arr[i].split("|");
                    var tablestring = table[0];
                    var intstring = table[1];
                    if (tablestring == "pricesinnerstring"){
                    document.getElementById('pricesinnerstring').innerHTML=intstring;                    			        
			        }
                    
                }
			 }
			document.body.style.cursor="default"; 
			return true;
		}
		else
		{
			return false;
		}
		document.body.style.cursor="default";
    }
    myRand=parseInt(Math.random()*99999999);    
    var url = "revajax.aspx?com=adminpricessort&whichdepot=" + whichdepot +  "&pricelist=" + pricelist +  "&whichsection=" + whichsection + "&rnd=" + myRand;
	ajaxRequest.open("GET", url, true);
	ajaxRequest.onreadystatechange = handleresponse;
	ajaxRequest.send(null);
}

 function updateminqty(minqty, prodcode, pricelist, depot, thissect, tabindex){


    
var ajaxRequest = createrequest();  // The variable that makes Ajax possible!
document.body.style.cursor="wait";

	// Create a function that will receive data sent from the server
	
    function handleresponse(){
		if(ajaxRequest.readyState == 4 && ajaxRequest.status == 200){
		    var response = ajaxRequest.responseText;
		    //alert(response);
		    response=response.substring(0,response.indexOf("<!DOCTYPE")-4);
        
            if(response=="")
            {
                window.location.reload();
            }
            else
            {
                var arr=response.split("~")
                
                for(var i=0;i<arr.length;i++)
                {
                    var table = arr[i].split("|");
                    var tablestring = table[0];
                    var intstring = table[1];
                   if (tablestring == "item1"){
                    document.getElementById('minqtyerrormessage' + prodcode).innerHTML=intstring;                    			        
			        }
                    
                }
			 }
			document.body.style.cursor="default"; 
			return true;
		}
		else
		{
			return false;
		}
		document.body.style.cursor="default";
    }
    myRand=parseInt(Math.random()*99999999);    
    var url = "revajax.aspx?com=updateminqty&prodcode=" + prodcode + "&minqty=" + minqty + "&depot=" + depot + "&thissect=" + thissect + "&pricelist=" + pricelist + "&tabindex=" + tabindex + "&rnd=" + myRand;
	ajaxRequest.open("GET", url, true);
	ajaxRequest.onreadystatechange = handleresponse;
	ajaxRequest.send(null);
}
 function updatetoqty1(toqty1, prodcode, pricelist, depot, thissect, tabindex){


    
var ajaxRequest = createrequest();  // The variable that makes Ajax possible!
document.body.style.cursor="wait";

	// Create a function that will receive data sent from the server
	
    function handleresponse(){
		if(ajaxRequest.readyState == 4 && ajaxRequest.status == 200){
		    var response = ajaxRequest.responseText;
		    //alert(response);
		    response=response.substring(0,response.indexOf("<!DOCTYPE")-4);
        
            if(response=="")
            {
                window.location.reload();
            }
            else
            {
                var arr=response.split("~")
                
                for(var i=0;i<arr.length;i++)
                {
                    var table = arr[i].split("|");
                    var tablestring = table[0];
                    var intstring = table[1];
                   if (tablestring == "item1"){
                    document.getElementById('toqty1errormessage' + prodcode).innerHTML=intstring;                    			        
			        }
			        if (tablestring == "item2"){			        
                    document.getElementById('pricesinnerstring').innerHTML=intstring;                    			        
			        }
			        
                    
                }
			 }
			document.body.style.cursor="default"; 
			return true;
		}
		else
		{
			return false;
		}
		document.body.style.cursor="default";
    }
    myRand=parseInt(Math.random()*99999999);    
    var url = "revajax.aspx?com=updatetoqty1&prodcode=" + prodcode + "&toqty1=" + toqty1 + "&depot=" + depot + "&thissect=" + thissect + "&pricelist=" + pricelist + "&tabindex=" + tabindex + "&rnd=" + myRand;
	ajaxRequest.open("GET", url, true);
	ajaxRequest.onreadystatechange = handleresponse;
	ajaxRequest.send(null);
}
 function updatetoqty2(toqty2, prodcode, pricelist, depot, thissect, tabindex){


    
var ajaxRequest = createrequest();  // The variable that makes Ajax possible!
document.body.style.cursor="wait";

	// Create a function that will receive data sent from the server
	
    function handleresponse(){
		if(ajaxRequest.readyState == 4 && ajaxRequest.status == 200){
		    var response = ajaxRequest.responseText;
		    //alert(response);
		    response=response.substring(0,response.indexOf("<!DOCTYPE")-4);
        
            if(response=="")
            {
                window.location.reload();
            }
            else
            {
                var arr=response.split("~")
                
                for(var i=0;i<arr.length;i++)
                {
                    var table = arr[i].split("|");
                    var tablestring = table[0];
                    var intstring = table[1];
                   if (tablestring == "item1"){
                    document.getElementById('toqty2errormessage' + prodcode).innerHTML=intstring;                    			        
			        }
			        if (tablestring == "item2"){			        
                    document.getElementById('pricesinnerstring').innerHTML=intstring;                    			        
			        }
			        
                    
                }
			 }
			document.body.style.cursor="default"; 
			return true;
		}
		else
		{
			return false;
		}
		document.body.style.cursor="default";
    }
    myRand=parseInt(Math.random()*99999999);    
    var url = "revajax.aspx?com=updatetoqty2&prodcode=" + prodcode + "&toqty2=" + toqty2 + "&depot=" + depot + "&thissect=" + thissect + "&pricelist=" + pricelist + "&tabindex=" + tabindex + "&rnd=" + myRand;
	ajaxRequest.open("GET", url, true);
	ajaxRequest.onreadystatechange = handleresponse;
	ajaxRequest.send(null);
}

 function updateprice1(price1, prodcode, pricelist, depot, thissect, tabindex, whichprice){


    
var ajaxRequest = createrequest();  // The variable that makes Ajax possible!
document.body.style.cursor="wait";

	// Create a function that will receive data sent from the server
	
    function handleresponse(){
		if(ajaxRequest.readyState == 4 && ajaxRequest.status == 200){
		    var response = ajaxRequest.responseText;
		    //alert(response);
		    response=response.substring(0,response.indexOf("<!DOCTYPE")-4);
        
            if(response=="")
            {
                window.location.reload();
            }
            else
            {
                var arr=response.split("~")
                
                for(var i=0;i<arr.length;i++)
                {
                    var table = arr[i].split("|");
                    var tablestring = table[0];
                    var intstring = table[1];
                   if (tablestring == "p1error"){
                    document.getElementById('price1errormessage' + prodcode).innerHTML=intstring;                    			        
			        }
			        if (tablestring == "p2error"){
                    document.getElementById('price2errormessage' + prodcode).innerHTML=intstring;                    			        
			        }
			        if (tablestring == "p3error"){
                    document.getElementById('price3errormessage' + prodcode).innerHTML=intstring;                    			        
			        }
			        
                    
                }
                
			 }
			document.body.style.cursor="default"; 
			return true;
		}
		else
		{
			return false;
		}
		document.body.style.cursor="default";
    }
    myRand=parseInt(Math.random()*99999999);    
    var url = "revajax.aspx?com=updateprice&prodcode=" + prodcode + "&price=" + price1 + "&depot=" + depot + "&thissect=" + thissect + "&pricelist=" + pricelist + "&tabindex=" + tabindex + "&whichprice=" + whichprice + "&rnd=" + myRand;
	ajaxRequest.open("GET", url, true);
	ajaxRequest.onreadystatechange = handleresponse;
	ajaxRequest.send(null);
}
 function updateprice2(price2, prodcode, pricelist, depot, thissect, tabindex, whichprice){

    
var ajaxRequest = createrequest();  // The variable that makes Ajax possible!
document.body.style.cursor="wait";

	// Create a function that will receive data sent from the server
	
    function handleresponse(){
		if(ajaxRequest.readyState == 4 && ajaxRequest.status == 200){
		    var response = ajaxRequest.responseText;
		    //alert(response);
		    response=response.substring(0,response.indexOf("<!DOCTYPE")-4);
        
            if(response=="")
            {
                window.location.reload();
            }
            else
            {
                var arr=response.split("~")
                
                for(var i=0;i<arr.length;i++)
                {
                    var table = arr[i].split("|");
                    var tablestring = table[0];
                    var intstring = table[1];
                   if (tablestring == "p1error"){
                    document.getElementById('price1errormessage' + prodcode).innerHTML=intstring;                    			        
			        }
			        if (tablestring == "p2error"){
                    document.getElementById('price2errormessage' + prodcode).innerHTML=intstring;                    			        
			        }
			        if (tablestring == "p3error"){
                    document.getElementById('price3errormessage' + prodcode).innerHTML=intstring;                    			        
			        }
			        
                    
                }
			 }
			document.body.style.cursor="default"; 
			return true;
		}
		else
		{
			return false;
		}
		document.body.style.cursor="default";
    }
    myRand=parseInt(Math.random()*99999999);    
    var url = "revajax.aspx?com=updateprice&prodcode=" + prodcode + "&price=" + price2 + "&depot=" + depot + "&thissect=" + thissect + "&pricelist=" + pricelist + "&tabindex=" + tabindex + "&whichprice=" + whichprice + "&rnd=" + myRand;
	ajaxRequest.open("GET", url, true);
	ajaxRequest.onreadystatechange = handleresponse;
	ajaxRequest.send(null);
}
 function updateprice3(price3, prodcode, pricelist, depot,thissect, tabindex, whichprice){


    
var ajaxRequest = createrequest();  // The variable that makes Ajax possible!
document.body.style.cursor="wait";

	// Create a function that will receive data sent from the server
	
    function handleresponse(){
		if(ajaxRequest.readyState == 4 && ajaxRequest.status == 200){
		    var response = ajaxRequest.responseText;
		    //alert(response);
		    response=response.substring(0,response.indexOf("<!DOCTYPE")-4);
        
            if(response=="")
            {
                window.location.reload();
            }
            else
            {
                var arr=response.split("~")
                
                for(var i=0;i<arr.length;i++)
                {
                    var table = arr[i].split("|");
                    var tablestring = table[0];
                    var intstring = table[1];
                   if (tablestring == "p1error"){
                    document.getElementById('price1errormessage' + prodcode).innerHTML=intstring;                    			        
			        }
			        if (tablestring == "p2error"){
                    document.getElementById('price2errormessage' + prodcode).innerHTML=intstring;                    			        
			        }
			        if (tablestring == "p3error"){
                    document.getElementById('price3errormessage' + prodcode).innerHTML=intstring;                    			        
			        }
			        
                    
                }
			 }
			document.body.style.cursor="default"; 
			return true;
		}
		else
		{
			return false;
		}
		document.body.style.cursor="default";
    }
    myRand=parseInt(Math.random()*99999999);    
    var url = "revajax.aspx?com=updateprice&prodcode=" + prodcode + "&price=" + price3 + "&depot=" + depot + "&thissect=" + thissect + "&pricelist=" + pricelist + "&tabindex=" + tabindex + "&whichprice=" + whichprice + "&rnd=" + myRand;
	ajaxRequest.open("GET", url, true);
	ajaxRequest.onreadystatechange = handleresponse;
	ajaxRequest.send(null);
}


function fnSetFocus(txtClientId)
        {
        	clientid=txtClientId;
        	setTimeout("fnFocus()",1000);
            
        }
        
        
  
        function fnFocus1(prodcode)
        
        {
        
            var clientid = "qty1display";
            eval("document.getElementById('" + clientid + prodcode + "').focus()");
        }
