/* 

__order_functions.js by KaiROO 16.03-2010
*/
var xmlHttp

function startOrder(arg1, arg2, iispConfKey)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="./functions/order.php"
url=url+"?action=startOrder"
url=url+"&arg1="+arg1
url=url+"&arg2="+arg2
url=url+"&iispConfKey="+iispConfKey
xmlHttp.onreadystatechange=stateChanged8
xmlHttp.open("GET",url,true)
xmlHttp.send(null)


    /* show wait sequence .. */
    if((target = query_object("mainDiv")))
        target.style.display = 'none';
    if((target = query_object("functionDiv"))) {
        var tmp_html = '<center><table><tr valign="middle"><td><br><br><img src="./img/ajax-loader.gif"><br><br>Går til bestillings-siden... Vennligst vent!</td></tr></table></center>';
        target.style.display = 'block';
        target.innerHTML = tmp_html;
    }
}

function orderReseller(resid, iispConfKey)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="./functions/order.php"
url=url+"?action=orderReseller"
url=url+"&resid="+resid
url=url+"&iispConfKey="+iispConfKey
xmlHttp.onreadystatechange=stateChanged10
xmlHttp.open("GET",url,true)
xmlHttp.send(null)


    /* show wait sequence .. */
    if((target = query_object("mainDiv")))
        target.style.display = 'none';
    if((target = query_object("functionDiv"))) {
        var tmp_html = '<center><table><tr valign="middle"><td><br><br><img src="./img/ajax-loader.gif"><br><br>Går til bestillings-siden... Vennligst vent!</td></tr></table></center>';
        target.style.display = 'block';
        target.innerHTML = tmp_html;
    }
}


function doFinnishReseller(iispConfKey) 
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
 
 var test = document.getElementsByName("invoice");
for (i = 0; i < test.length; i++) {
if (test[i].checked)
var invoice = test[i].value;

}
 
var url="./functions/order.php"
url=url+"?action=doFinnishReseller"
url=url+"&iispConfKey="+iispConfKey
url=url+= '&f_name=' + ((tmp = query_object("f_name")) ? tmp.value : '');
url=url+= '&e_name=' + ((tmp = query_object("e_name")) ? tmp.value : '');
url=url+= '&firm=' + ((tmp = query_object("firm")) ? tmp.value : '');
url=url+= '&adress=' + ((tmp = query_object("adress")) ? tmp.value : '');
url=url+= '&postal=' + ((tmp = query_object("postal")) ? tmp.value : '');
url=url+= '&plocation=' + ((tmp = query_object("plocation")) ? tmp.value : '');
url=url+= '&phone=' + ((tmp = query_object("phone")) ? tmp.value : '');
url=url+= '&email=' + ((tmp = query_object("email")) ? tmp.value : '');
url=url+= '&rpakke=' + ((tmp = query_object("rpakke")) ? tmp.value : '');
url=url+= '&btid=' + ((tmp = query_object("btid")) ? tmp.value : '');
url=url+= '&dombes=' + ((tmp = query_object("dombes")) ? tmp.checked : '');
url=url+= '&setusername=' + ((tmp = query_object("setusername")) ? tmp.value : '');
url=url+= '&setpassword=' + ((tmp = query_object("setpassword")) ? tmp.value : '');
url=url+"&invoice="+invoice
xmlHttp.onreadystatechange=stateChanged8
xmlHttp.open("GET",url,true)
xmlHttp.send(null)


    /* show wait sequence .. */
    if((target = query_object("mainDiv")))
        target.style.display = 'none';
    if((target = query_object("functionDiv"))) {
        var tmp_html = '<center><table><tr valign="middle"><td><br><br><img src="./img/ajax-loader.gif"><br><br>Går til bestillings-siden... Vennligst vent!</td></tr></table></center>';
        target.style.display = 'block';
        target.innerHTML = tmp_html;
    }
}



function orderDserver(dedid,iispConfKey)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="./functions/order.php"
url=url+"?action=orderDserver"
url=url+"&dedid="+dedid
url=url+"&iispConfKey="+iispConfKey
xmlHttp.onreadystatechange=stateChanged10
xmlHttp.open("GET",url,true)
xmlHttp.send(null)


    /* show wait sequence .. */
    if((target = query_object("mainDiv")))
        target.style.display = 'none';
    if((target = query_object("functionDiv"))) {
        var tmp_html = '<center><table><tr valign="middle"><td><br><br><img src="./img/ajax-loader.gif"><br><br>Går til bestillings-siden... Vennligst vent!</td></tr></table></center>';
        target.style.display = 'block';
        target.innerHTML = tmp_html;
    }
}

function doFinnishDserver(iispConfKey) 
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
 
 var test = document.getElementsByName("invoice");
for (i = 0; i < test.length; i++) {
if (test[i].checked)
var invoice = test[i].value;

}
 
var url="./functions/order.php"
url=url+"?action=doFinnishDserver"
url=url+"&iispConfKey="+iispConfKey
url=url+= '&f_name=' + ((tmp = query_object("f_name")) ? tmp.value : '');
url=url+= '&e_name=' + ((tmp = query_object("e_name")) ? tmp.value : '');
url=url+= '&firm=' + ((tmp = query_object("firm")) ? tmp.value : '');
url=url+= '&adress=' + ((tmp = query_object("adress")) ? tmp.value : '');
url=url+= '&postal=' + ((tmp = query_object("postal")) ? tmp.value : '');
url=url+= '&plocation=' + ((tmp = query_object("plocation")) ? tmp.value : '');
url=url+= '&phone=' + ((tmp = query_object("phone")) ? tmp.value : '');
url=url+= '&email=' + ((tmp = query_object("email")) ? tmp.value : '');
url=url+= '&rpakke=' + ((tmp = query_object("rpakke")) ? tmp.value : '');
url=url+= '&btid=' + ((tmp = query_object("btid")) ? tmp.value : '');
url=url+= '&atid=' + ((tmp = query_object("atid")) ? tmp.value : '');
url=url+= '&dombes=' + ((tmp = query_object("dombes")) ? tmp.checked : '');
url=url+= '&setusername=' + ((tmp = query_object("setusername")) ? tmp.value : '');
url=url+= '&setpassword=' + ((tmp = query_object("setpassword")) ? tmp.value : '');
url=url+"&invoice="+invoice
xmlHttp.onreadystatechange=stateChanged8
xmlHttp.open("GET",url,true)
xmlHttp.send(null)


    /* show wait sequence .. */
    if((target = query_object("mainDiv")))
        target.style.display = 'none';
    if((target = query_object("functionDiv"))) {
        var tmp_html = '<center><table><tr valign="middle"><td><br><br><img src="./img/ajax-loader.gif"><br><br>Går til bestillings-siden... Vennligst vent!</td></tr></table></center>';
        target.style.display = 'block';
        target.innerHTML = tmp_html;
    }
}


function __doselect() {
    if((target = query_object("f_name"))) {
        target.focus();
        if (target.value && target.value.length)
            target.select();
    }
}


function checkDomain(arg1,arg2,arg3)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="./functions/order.php"
url=url+"?action=checkDomain"
url=url+"&arg1="+arg1
url=url+"&arg2="+arg2
url=url+"&arg3="+arg3
xmlHttp.onreadystatechange=stateChanged10
xmlHttp.open("GET",url,true)
xmlHttp.send(null)

}

function doFinnishOrder(domname,arg2,arg3)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
 

var test = document.getElementsByName("invoice");
for (i = 0; i < test.length; i++) {
if (test[i].checked)
var invoice = test[i].value;

}


 
var url="./functions/order.php"
url=url+"?action=doFinnishOrder"
url=url+"&domname="+domname
url=url+"&arg2="+arg2
url=url+"&arg3="+arg3
url=url+= '&f_name=' + ((tmp = query_object("f_name")) ? tmp.value : '');
url=url+= '&e_name=' + ((tmp = query_object("e_name")) ? tmp.value : '');
url=url+= '&firm=' + ((tmp = query_object("firm")) ? tmp.value : '');
url=url+= '&adress=' + ((tmp = query_object("adress")) ? tmp.value : '');
url=url+= '&postal=' + ((tmp = query_object("postal")) ? tmp.value : '');
url=url+= '&plocation=' + ((tmp = query_object("plocation")) ? tmp.value : '');
url=url+= '&phone=' + ((tmp = query_object("phone")) ? tmp.value : '');
url=url+= '&email=' + ((tmp = query_object("email")) ? tmp.value : '');
url=url+= '&setauthcode=' + ((tmp = query_object("setauthcode")) ? tmp.value : '');
url=url+= '&webpack=' + ((tmp = query_object("webpack")) ? tmp.value : '');
url=url+= '&servertype=' + ((tmp = query_object("servertype")) ? tmp.value : '');
url=url+= '&setusername=' + ((tmp = query_object("setusername")) ? tmp.value : '');
url=url+= '&setpassword=' + ((tmp = query_object("setpassword")) ? tmp.value : '');
url=url+"&invoice="+invoice
xmlHttp.onreadystatechange=stateChanged8
xmlHttp.open("GET",url,true)
xmlHttp.send(null)

    /* show wait sequence .. */
    if((target = query_object("mainDiv")))
        target.style.display = 'none';
    if((target = query_object("functionDiv"))) {
        var tmp_html = '<div id="servicesTop"></div><div id="services-wrap"><div id="services" class="container_16 clearfix"><p align=center><img src="./img/ajax-loader.gif"><br><br><font color=white>Vennligst vent mens vi behandler din bestilling...</font></p></div></div>';
        target.style.display = 'block';
        target.innerHTML = tmp_html;
    }
}


function paypalFinish()
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="./functions/order.php"
url=url+"?action=paypalFinish"
xmlHttp.onreadystatechange=stateChanged8
xmlHttp.open("GET",url,true)
xmlHttp.send(null)

    /* show wait sequence .. */
    if((target = query_object("mainDiv")))
        target.style.display = 'none';
    if((target = query_object("functionDiv"))) {
        var tmp_html = '<center><table><tr valign="middle"><td><br><br><br><br><br><br><br><img src="./img/ajax-loader.gif"><br><br><font color=white>Prosesserer..Vennligst vent!</td></tr></table></center>';
        target.style.display = 'block';
        target.innerHTML = tmp_html;
    }
}


function moveOrder(arg1, arg2, arg3)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="./functions/order.php"
url=url+"?action=moveOrder"
url=url+"&arg1="+arg1
url=url+"&arg2="+arg2
url=url+"&arg3="+arg3
xmlHttp.onreadystatechange=stateChanged10
xmlHttp.open("GET",url,true)
xmlHttp.send(null)

}

function doPaypalTransaction() {
	
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="./functions/paypal_finish.php"

xmlHttp.onreadystatechange=stateChanged15
xmlHttp.open("GET",url,true)
xmlHttp.send(null)

}	
			
    /* show wait sequence .. */
    if((target = query_object("confirmDiv")))
        target.style.display = 'none';
    if((target = query_object("transactionDiv"))) {
        var tmp_html = '<div id="servicesTop"></div><div id="services-wrap"><div id="services" class="container_16 clearfix"><p align=center><img src="./img/ajax-loader.gif"><br><br><font color=white>Vennligst vent mens din transaksjon og domenebestilling gjennomføres...Dette kan ta noe tid</font></p></div></div>';
        target.style.display = 'block';
        target.innerHTML = tmp_html;
    }
    
   } 

/*DO THE AJAX CALLS*/
function stateChanged8() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 	
 document.getElementById("functionDiv").innerHTML=xmlHttp.responseText 

 } 
 
}

/*DO THE AJAX END CALLS WITH AUTOREFRESH*/
function stateChanged9() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 location.reload();
 document.getElementById("functionDiv").innerHTML=xmlHttp.responseText 
 
 } 
 
}

/*DO THE AJAX CALLS WITHOUT AUTOREFRESH*/
function stateChanged10() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
	
 document.getElementById("functionDiv").innerHTML=xmlHttp.responseText 
 setTimeout("__doselect()", 50);
 } 
}

/*DO THE AJAX TRANSACTION CALLS */
function stateChanged15() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 	
 document.getElementById("transactionDiv").innerHTML=xmlHttp.responseText 

 } 
 
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 //Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}
