function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function ViewArtwork(OrderItemID)
{
	window.open("artwork_popup_front.php?OrderItemID="+OrderItemID+"",'',"width=800, height=800,scrollbars=yes,screenX=100,screenY=100,location=0,resizable=1,status=1, toolbar=0,menubar=0",false);
}
function ViewArtworks(ReOrderItemID)
{
	window.open("artwork_popup.php?ReOrderItemID="+ReOrderItemID+"",'',"width=800,height=800,scrollbars=yes,screenX=100,screenY=100,location=0,resizable=1,status=1, toolbar=0,menubar=0", false);
}	
var req;
var msg_no;
var msg_test;
var doesNotSupport = true;

/* Check Login ends */
function getLogin(url,Username,Password)
{	
	error=document.getElementById('error_dispaly');	
	error.innerHTML = "Please wait..&nbsp;";
	if (window.XMLHttpRequest) {
        req = new XMLHttpRequest;
    } else if (window.ActiveXObject) {
        req = new ActiveXObject("Microsoft.XMLHTTP");
    }
	
    if(req) 
	{
       
	   req.onreadystatechange = processReqLogin;
       req.open("GET", url + '?Username=' + Username + '&Password='+Password, true);
       req.send(null);
    } 
	return false;
}

function processReqLogin() 
{
   if(req.readyState == 4) 
   {
	   if(req.status == 200) 
	   {
			msg_no=req.responseText.substr(0,1);
			msg_test=req.responseText.substr(2);
			if(msg_no == 1)
			{
				window.location.href=msg_test;
			}
			else
			{
				error.innerHTML = "";
				error.innerHTML = msg_test;
			}
	   } 
  }
}
/* Check Login ends */


/* Check Login On Checkout starts */

function CheckLoginCheckout()
{					
	document.getElementById("errormessage").innerHTML = "Please wait..&nbsp;";
	if (window.XMLHttpRequest) {
        req = new XMLHttpRequest;
    } else if (window.ActiveXObject) {
        req = new ActiveXObject("Microsoft.XMLHTTP");
    }
	
    if(req) 
	{       
	   req.onreadystatechange = processCheckLogin;
       req.open("GET", 'login_flow_check.php?LoginFlowStatus=C', true);
       req.send(null);
    } 
	return false;
}

function processCheckLogin() 
{
	
   if(req.readyState == 4) 
   {
   		
	   if(req.status == 200) {

			if(req.responseText == 1)
			{				
				//MM_goToURL('parent','checkout.php');
				changeflow("check");				
			}
			else
			{
				document.getElementById("errormessage").innerHTML = "";
				document.getElementById("errormessage").innerHTML = req.responseText;
			}			
	   } 
  }
}

/* Check Login On Checkout ends */


/* Check Login On Quote Checkout starts */

function CheckLoginQuoteCheckout(ProductID)
{						
	document.getElementById("errormessage").innerHTML = "Please wait..&nbsp;";
	if (window.XMLHttpRequest) {
        req = new XMLHttpRequest;
    } else if (window.ActiveXObject) {
        req = new ActiveXObject("Microsoft.XMLHTTP");
    }
	
    if(req) 
	{       
	   req.onreadystatechange = processQuoteCheckLogin;
       req.open("GET", 'login_flow_check.php?LoginFlowStatus=Q&ProductID='+ProductID, true);
       req.send(null);
    } 
	return false;
}

function processQuoteCheckLogin() 
{
	
   if(req.readyState == 4) 
   {
   		
	   if(req.status == 200) {

			if(req.responseText == 1)
			{	
				ProductID=document.frmProduct.ProductID.value;			
				window.location.href="quote_request.php?ProductID="+ProductID;				
			}
			else
			{
				document.getElementById("errormessage").innerHTML = "";
				document.getElementById("errormessage").innerHTML = req.responseText;
			}			
	   } 
  }
}

/* Check Login On Quote Checkout ends */

/* Check numbersonly starts */
function numbersonly(myfield, e, dec)
{
	var key;
	var keychar;
	if (window.event)
	key = window.event.keyCode;
	else if (e)
	key = e.which;
	else
	return true;
	keychar = String.fromCharCode(key);
	// control keys
	if ((key==null) || (key==0) || (key==8) || 
	(key==9) || (key==13) || (key==27))
	return true;
	// numbers
	else if ((("0123456789").indexOf(keychar) > -1))
	return true;
	// decimal point jump
	else if (dec && (keychar == "."))
	{
	myfield.form.elements[dec].focus();
	return false;
	}
	else
	return false;
}

/* Check numbersonly ends */

