
	  
	  function processReqChange() {
	  
	
	  
	  
	  	$("#a2cbutton").hide();$("#submit_status").show();
		document.getElementById("submit_status").innerHTML="<div class='loadingorder'>Please wait...</div><br>";		 
				
		if (req.readyState == 4) {
    	    if (req.status == 200) {
				
				// $('#submit_status').fadeOut(200); 
				document.getElementById("submit_status").innerHTML="<font color='green'><img src='/tp/tpimg/submit-successful.gif'>Product added to your cart...</font><br><span><a href='http://www.tangoprint.com/tp/cart.php'>[Continue to Checkout....]</span></a>";
				
				
				  $('#submit_status').fadeIn(100); 
				  
				  $("#a2cbutton").show().animate({opacity: 1.0}, 2000).fadeIn(3000);
				  $("#submit_status").show().animate({opacity: 1.0}, 7000).fadeOut(2000); 
	
	
				
	 
					
					 
				
	        } else {
				document.getElementById("submit_status").innerHTML=req.status+"<font color='red'><img src='/tp/tpimg/submit-error.gif'>ERROR: You missed a required option. Please try again.</font>";
				
        	}
			document.getElementById("submit_status").style.display="block";
    	}
	 }
	 
	function formsubmit(el_str) {  
		var elem=document.getElementById(el_str);
		var url = "http://www.tangoprint.com/tp/cart.php";
		//
		//var url=elem.getAttribute("action");
		//serilize form
		data = [];
		recursivesearch(elem);
		var params=data.join("&");
		//send over AJAX
	    if (window.XMLHttpRequest) {
	        req = new XMLHttpRequest();
    	    req.onreadystatechange = processReqChange;
        	req.open("POST", url, true);
			req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			req.setRequestHeader("Content-length", params.length);
	        req.send(params);       
	    } else if (window.ActiveXObject) {
    	    req = new ActiveXObject("Microsoft.XMLHTTP");
        	if (req) {
            	req.onreadystatechange = processReqChange;
	        	req.open("POST", url, true);
				req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
				req.setRequestHeader("Content-length", params.length);				
    	        req.send(params);
        	}
	    }
		return false;
	}
	



	
	
	//***************
	
	var currentlyActiveInputRef = false;
var currentlyActiveInputClassName = false;

function highlightActiveInput()
{
	if(currentlyActiveInputRef){
		currentlyActiveInputRef.className = currentlyActiveInputClassName;
	}
	currentlyActiveInputClassName = this.className;
	this.className = 'inputHighlighted';
	currentlyActiveInputRef = this;
	
	
}

function blurActiveInput()
{
	this.className = currentlyActiveInputClassName;
	
	
}


function initInputHighlightScript()
{
	var tags = ['INPUT','TEXTAREA'];
	
	for(tagCounter=0;tagCounter<tags.length;tagCounter++){
		var inputs = document.getElementsByTagName(tags[tagCounter]);
		for(var no=0;no<inputs.length;no++){
			if(inputs[no].className && inputs[no].className=='doNotHighlightThisInput')continue;
			
			if(inputs[no].tagName.toLowerCase()=='textarea' || (inputs[no].tagName.toLowerCase()=='input' && inputs[no].type.toLowerCase()=='text') || (inputs[no].tagName.toLowerCase()=='input' && inputs[no].type.toLowerCase()=='password')){
				inputs[no].onfocus = highlightActiveInput;
				inputs[no].onblur = blurActiveInput;
			}
		}
	}
}



 $(document).ready( function()
      {
         PEPS.rollover.init();
		 
		 

		 
      });
      
      PEPS = {};
      
      PEPS.rollover =
      {
         init: function()
         {
            this.preload();
            
            $(".ro").hover(
               function () { $(this).attr( 'src', PEPS.rollover.newimage($(this).attr('src')) ); },
               function () { $(this).attr( 'src', PEPS.rollover.oldimage($(this).attr('src')) ); }
            );
         },
         
         preload: function()
         {
            $(window).bind('load', function() {
               $('.ro').each( function( key, elm ) { $('<img>').attr( 'src', PEPS.rollover.newimage( $(this).attr('src') ) ); });
            });
         },
         
         newimage: function( src ) { return src.substring( 0, src.search(/(\.[a-z]+)/) ) + '_o' + src.match(/(\.[a-z]+)/)[0]; },
         oldimage: function( src ){ return src.replace(/_o/, ''); }
      };
		
		
		
		
		
		
		
		
		var data=[];
	   var req;
     function recursivesearch(el) { for (var i=0;i<el.childNodes.length;i++) { if (el.childNodes[i].nodeName=="INPUT" || el.childNodes[i].nodeName=="TEXTAREA" || el.childNodes[i].nodeName=="SELECT" || el.childNodes[i].nodeName=="BUTTON") { if (el.childNodes[i].nodeName=="INPUT" && el.childNodes[i].getAttributeNode("type").value=="checkbox") { if (el.childNodes[i].checked) data.push(el.childNodes[i].name+"="+el.childNodes[i].value); } else if (el.childNodes[i].nodeName=="INPUT" && el.childNodes[i].getAttributeNode("type").value=="radio") { if (el.childNodes[i].checked) data.push(el.childNodes[i].name+"="+el.childNodes[i].value); } else { data.push(el.childNodes[i].name+"="+el.childNodes[i].value); } } else { if (el.childNodes[i].nodeType==1 && el.childNodes[i].childNodes.length>0) { recursivesearch(el.childNodes[i]); } } } }
	  
	  
	  
	  
	  
	  function lsupport() {
    window.open("/tp/chat.php","Tango Print Live Support","menubar=no,width=500,height=400,toolbar=no");
}
