<!--//
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();
var ajaxA = getXmlHttpRequestObject();
var ajaxB = 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 processAjaxRequestA(param, action, method, func, id){
//If our XmlHttpRequest object is not in the middle of a request, start the new asyncronous call.
	if (ajaxA.readyState == 4 || ajaxA.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).
		ajaxA.open(method, action, true);
		//Set the function that will be called when the XmlHttpRequest objects state changes.
		ajaxA.onreadystatechange = eval(func);
		//Send the proper header information along with the POST request
		ajaxA.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		ajaxA.setRequestHeader("Content-length", out.length);
		ajaxA.setRequestHeader("Connection", "close");
		//Make the actual request.
		//ajaxA.cid = id;
		ajaxA.send(out);
	}
}

function processAjaxRequestB(param, action, method, func, id){
//If our XmlHttpRequest object is not in the middle of a request, start the new asyncronous call.
	if (ajaxB.readyState == 4 || ajaxB.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).
		ajaxB.open(method, action, true);
		//Set the function that will be called when the XmlHttpRequest objects state changes.
		ajaxB.onreadystatechange = eval(func);
		//Send the proper header information along with the POST request
		ajaxB.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		ajaxB.setRequestHeader("Content-length", out.length);
		ajaxB.setRequestHeader("Connection", "close");
		//Make the actual request.
		//ajaxB.cid = id;
		ajaxB.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, 'http://www.celebritytalent.net/sampletalent/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, 'http://www.celebritytalent.net/sampletalent/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, 'http://www.celebritytalent.net/sampletalent/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>';
	}
}

function talentType(cat){
	var tal = cat;

	document.getElementById("talLink2").style.border = '';
	document.getElementById("talLink2").style.color = '';
	document.getElementById("talLink3").style.border = '';
	document.getElementById("talLink3").style.color = '';
	document.getElementById("talLink4").style.border = '';
	document.getElementById("talLink4").style.color = '';
	document.getElementById("talLink6").style.border = '';
	document.getElementById("talLink6").style.color = '';

	document.getElementById("talLink"+cat).style.border = "1px solid silver";
	document.getElementById("talLink"+cat).style.color = "#EC8E0C";

	document.getElementById("step3").innerHTML = '<div style="text-align:center;padding-top:15px;color:#C0C0C0;">Please a subcategory above to view fee ranges...</div>';
	document.getElementById("talent_list").innerHTML = '';

	var out = "cid="+tal;
	processAjaxRequest(out, 'http://www.celebritytalent.net/sampletalent/talstep_a.php', 'POST', 'talentTypeOut', 'cart');
}

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

function talentBudget(cat){
	var tal = cat;
	var talType = '';
	var talCheck = document.budget.taltop;
	var CntChecked=0;
	for (i=0; i<talCheck.length; i++){
		talCheck[i].style.backgroundColor = '';
		if (talCheck[i].checked==true){
			talType = talType + talCheck[i].value + ',';
			talCheck[i].style.backgroundColor = '#EC8E0C';
			CntChecked++;
		}
	}

	if(CntChecked > 0){
		var popComma = talType.lastIndexOf(',');
		talType = talType.substr(0,popComma);
		var out = "cid="+tal+"&type="+talType;
		processAjaxRequest(out, 'http://www.celebritytalent.net/sampletalent/talstep_b.php', 'POST', 'talentBudgetOut', 'cart');
		
		document.getElementById("talent_list").innerHTML = 'Please choose a budget';
	}else{
		document.getElementById("step3").innerHTML = '<div style="text-align:center;padding-top:15px;color:#C0C0C0;">Please a subcategory above to view fee ranges...</div>';
	}
}

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

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


function talentList(cat,taltype,budget){
	var tal = cat;
	var budgetAry = new Array("500-999", "1000-2499", "2500-9999","10000-19999", "20000-29999","30000-39999","40000-49999","50000-59999","60000-79999","80000-99999","100000-149999","150000-249999","250000-499999","500000-999999","1000000-2000000");
	for (i=0; i<budgetAry.length; i++){
		if (budgetAry[i] == budget){
			document.getElementById(budget).style.color = "#EC8E0C";
			document.getElementById(budget).style.fontWeight = "bold";
		}else{
			if(document.getElementById(budgetAry[i]) != null){
				document.getElementById(budgetAry[i]).style.color = "";
				document.getElementById(budgetAry[i]).style.fontWeight = "";							
			}
		}
	}

	//var popComma = talType.lastIndexOf(',');
	//talType = talType.substr(0,popComma);
	var out = "cid="+tal+"&type="+taltype+"&budget="+budget;
	processAjaxRequest(out, 'http://www.celebritytalent.net/sampletalent/talstep_c.php', 'POST', 'talentListOut', 'cart');
}

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

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

function TalentSummary(pid){
	var out = "ca=addtal&talent="+pid;
	processAjaxRequest(out, 'http://www.celebritytalent.net/sampletalent/talview.php', 'POST', 'TalentSummaryOut', 'info'+pid);

	//return true;
}

function TalentSummaryOut(){
	//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:640, height:250, 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 TalentSession(){
	out = 'selections=1';
	processAjaxRequest(out, 'http://www.celebritytalent.net/sampletalent/talses.php', 'POST', 'TalentSessionOut', 'sess');

	//return true;
}

function TalentSessionOut(){
	if (ajax.readyState == 4) {

	var talSesVars = eval(ajax.responseText);
	var tal = talSesVars[0];
	var talType = talSesVars[1];
	var talTypeBase = talSesVars[2];
	var budget = talSesVars[3];
	
	//alert(talType);

	talentType(tal);	
	//talentBudget(tal);

	//var tal = tal;
	//var talType = '';
	//var talCheck = document.budget.taltop;
	//var CntChecked=0;
	//for (i=0; i<talCheck.length; i++){
	//	if (talCheck[i].checked==true){
	//		talType = talType + talCheck[i].value + ',';
	//		CntChecked++;
	//	}
	//}

	//if(talType.length > 0){
		var budgetSel = "cid="+tal+"&type="+talType;
		var talSel = "cid="+tal+"&type="+talTypeBase+"&budget="+budget;
		
		//alert(tal);

		processAjaxRequestA(budgetSel, 'http://www.celebritytalent.net/sampletalent/talstep_b.php', 'POST', 'talentBudgetOutAlt', 'cart');
		processAjaxRequestB(talSel, 'http://www.celebritytalent.net/sampletalent/talstep_c.php', 'POST', 'talentListOutAlt', 'cart');
		
	//}else{
	//	document.getElementById("step3").innerHTML = 'Please choose a from step 2';
	//}
	
	
	}else{
		//document.getElementById(spanid).innerHTML = '<div align="center" style="padding-top:30px"><img src="loading.gif" width="24" height="24"/></div>';
	}
}


//-->
