<!--//
var confirmWin= null;
function oContent(page,name,w,h,scroll,resize)
{
var winl = (screen.width-w)/2;
var wint = (screen.height-h)/2;
var settings = 'height='+h+',';
	settings += 'width='+w+',';
	settings += 'top='+wint+',';
      	settings += 'left='+winl+',';
	settings += 'scrollbars='+scroll+',';
	settings += 'resizable='+resize+'';
	
	var confirmWin = window.open(page,name,settings);
  	
  	if(confirmWin.opener==null){
		confirmWin.opener = self;
	} 
	if(parseInt(navigator.appVersion) >= 4){
		confirmWin.window.focus();
	}
}

function borderize(what,color){
	what.style.backgroundColor=color
}

function borderize_on(e)
{
	if (document.all)
		source3=event.srcElement
	else if (document.getElementById)
		source3=e.target
	if (source3.className=="menu"){
		borderize(source3,"#DBDBDB")
	}else{
		while(source3.tagName!="TABLE"){
			source3=document.getElementById? source3.parentNode : source3.parentElement
			if (source3.className=="menu")
			borderize(source3,"#DBDBDB")
		}
	}
}

function borderize_off(e)
{
	if (document.all)
		source4=event.srcElement
	else if (document.getElementById)
		source4=e.target
	if (source4.className=="menu"){
		borderize(source4,"EBEBEB")
	}else{
		while(source4.tagName!="TABLE"){
		source4=document.getElementById? source4.parentNode : source4.parentElement
		if (source4.className=="menu")
		borderize(source4,"EBEBEB")
		}
	}
}

function validate(theForm){
	if (theForm.FirstName.value == "" || theForm.FirstName.value.length < 2){
		alert("Please fill in your First Name.");
		theForm.FirstName.focus();
		return false;
	}
	if (theForm.LastName.value == "" || theForm.LastName.value.length < 2){
		alert("Please fill in your Last Name.");
		theForm.LastName.focus();
		return false;
	}
	if (theForm.CompanyName.value == "" || theForm.CompanyName.value.length < 2){
		alert("Please fill in your Company Name.");
		theForm.CompanyName.focus();
		return false;
	}
	if (theForm.Phone.value == "" || theForm.Phone.value.length < 10){
		alert("Please fill in your Phone Number");
		theForm.Phone.focus();
		return false;
	}
	if (theForm.Email.value == "" || theForm.Email.value.indexOf('@',1)== -1 || theForm.Email.value.indexOf('.',2)==-1){
		alert("Please fill in your Email Address.");
		theForm.Email.focus();
		return false;
	}
return true;
}

//Gets the browser specific XmlHttpRequest Object
function getXmlHttpRequestObject() {
	if (window.XMLHttpRequest) {
		return new XMLHttpRequest(); //Not IE
	} else if(window.ActiveXObject) {
		return new ActiveXObject("Microsoft.XMLHTTP"); //IE
	} else {
		//Display error message here and inform the user they should upgrade their browser.
		alert("Your browser doesn't support the XmlHttpRequest object.  Please upgrade to IE7 or Firefox.");
	}
}
//Get our browser specific XmlHttpRequest object.
var ajax = getXmlHttpRequestObject();
//Initiate the asyncronous request.

function processAjaxRequest(param, action, method, func, id){
//If our XmlHttpRequest object is not in the middle of a request, start the new asyncronous call.
	if (ajax.readyState == 4 || ajax.readyState == 0) {
		cust = new Object()
		//cust.id = id

		var out = param;
		//Setup the connection as a GET call to SayHello.html.
		//True explicity sets the request to asyncronous (default).
		ajax.open(method, action, true);
		//Set the function that will be called when the XmlHttpRequest objects state changes.
		ajax.onreadystatechange = eval(func);
		//Send the proper header information along with the POST request
		ajax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		ajax.setRequestHeader("Content-length", out.length);
		ajax.setRequestHeader("Connection", "close");
		//Make the actual request.
		//ajax.cid = id;
		ajax.send(out);
	}
}

function AddToCartCallSingle(pid){
	//var newLimit = document.getElementById('mlimit_'+element+'').value;
	//if(newLimit.length != ""){
	//	if(curval != newLimit){

	//var qty = document.getElementById("qty-"+pid).value;

	var out = "ca=addtal&talent="+pid;
	//		var functionOut = "";
	processAjaxRequest(out, 'talcartadd.php', 'POST', 'AddToCartOut', 'info'+pid);

	//	}
	//}

	return false;
}

function AddToCartCall(pid){
	//var newLimit = document.getElementById('mlimit_'+element+'').value;
	//if(newLimit.length != ""){
	//	if(curval != newLimit){

	var spid = document.getElementById("item-"+pid).value;
	var qty = document.getElementById("qty-"+pid).value;

	var out = "prodid="+pid+"&item="+spid+"&quantity="+qty;
	//		var functionOut = "";
	processAjaxRequest(out, 'talcartadd.php', 'POST', 'AddToCartOut', 'info'+pid);

	//	}
	//}

	return false;
}

function AddToCartOut(){
	//var spanid = ajax.cid;
	if (ajax.readyState == 4) {
		//Set the contents of our span element to the result of the asyncronous call.
		//var response = ajax.responseXML.documentElement;

		//var id = response.getElementsByTagName('id')[0].firstChild.data;
		//var href = response.getElementsByTagName('href')[0].firstChild.data;
		//var name = response.getElementsByTagName('name')[0].firstChild.data;

	//alert(ajax.responseText);
	Dialog.alert(ajax.responseText, {className:"alphacube", width:400, height:320, okLabel: "Return", ok:function(win) {debug("validate alert panel"); return true;}});
	CartContentsCall();


	//document.getElementById(spanid).innerHTML = ajax.responseText;
	}else{
		//document.getElementById(spanid).innerHTML = '<div align="center" style="padding-top:30px"><img src="loading.gif" width="24" height="24"/></div>';
	}
}

function CartContentsCall(){
	var out = "";
	processAjaxRequest(out, 'talcartcontents.php', 'POST', 'CartContentsOut', 'cart');
	return false;
}

function CartContentsOut(){
	//var spanid = ajax.cid;
	if (ajax.readyState == 4) {
		//Set the contents of our span element to the result of the asyncronous call.
		document.getElementById("talcart").innerHTML = ajax.responseText;
		document.getElementById("ilist").checked = true;
	}else{
		//document.getElementById(spanid).innerHTML = '<div align="center" style="padding-top:30px"><img src="loading.gif" width="24" height="24"/></div>';
	}
}

//-->