<!--
var request=null;
try {
	request = new XMLHttpRequest();
} catch (trymicrosoft) {
	try {
		request = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (othermicrosoft) {
		try {
			request = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (failed) {
			request = null;
		}
	}
}

if (request == null) {
	alert("Error creating request object!");
}

function getInfo()
{
	var display_name = document.getElementById("display_name").value;
	var homepage_url = document.getElementById("homepage_url").value;
	var location = document.getElementById("location").value;
	var aim_sn = document.getElementById("aim_sn").value;
	var msn_sn = document.getElementById("msn_sn").value;
	var yahoo_sn = document.getElementById("yahoo_sn").value;
	var google_sn = document.getElementById("google_sn").value;
	var expertise = document.getElementById("expertise").value;
	var tools = document.getElementById("tools").value;
	var current_employment = document.getElementById("current_employment").value;
	var short_bio = document.getElementById("short_bio").value;
	var PSID = document.getElementById("PSID").value;

	var url="my_personal_info.php";
	request.open("POST", url, true);
	request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	request.onreadystatechange = updatePage;
	request.send(	"&display_name=" + escape(display_name) +
			"&homepage_url=" + escape(homepage_url) + 
			"&location=" + escape(location) + "&aim_sn=" + escape(aim_sn) +
			"&msn_sn=" + escape(msn_sn) + "&yahoo_sn=" + escape(yahoo_sn) + 
			"&google_sn=" + escape(google_sn) + 
			"&expertise=" + escape(expertise) + 
			"&tools=" + escape(tools) + 
			"&current_employment=" + escape(current_employment) + 
			"&short_bio=" + escape(short_bio) + 
			"&PSID=" + escape(PSID));
}

function getAccountInfo()
{
	var email = document.getElementById("email").value;
	var old_password = document.getElementById("old_password").value;
	var new_password = document.getElementById("new_password").value;
	var confirm_password = document.getElementById("confirm_password").value;
	var paypal_email = document.getElementById("paypal_email").value;
	var email_me_flag = document.getElementById("email_me_flag").checked;
	var donate_flag = document.getElementById("donate_flag").checked;
	var country = document.getElementById("country").value;
	var radioObj = document.myAcctform.member_type;
	var radioLength = radioObj.length;
	for (var i=0; i<radioLength; i++)
	{
		if(radioObj[i].checked)
		{
			var member_type = radioObj[i].value;
			break;
		}
	}
	
	var PSID = document.getElementById("PSID").value;

	var url="my_account_info.php";
	request.open("POST", url, true);
	request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	request.onreadystatechange = updatePage;
	request.send(	"&email=" + escape(email) +
			"&old_password=" + escape(old_password) +
			"&new_password=" + escape(new_password) +
			"&confirm_password=" + escape(confirm_password) +
			"&paypal_email=" + escape(paypal_email) +
			"&email_me_flag=" + escape(email_me_flag) +
			"&donate_flag=" + escape(donate_flag) +
			"&member_type=" + escape(member_type) +
			"&country=" + escape(country) +
			"&PSID=" + escape(PSID));
}

function getw9Info()
{
	var w9_name = document.getElementById("w9_name").value;
	var w9_business_name = document.getElementById("w9_business_name").value;
	var w9_type = document.getElementById("w9_type").value;
	var w9_other_type = document.getElementById("w9_other_type").value;
	var w9_exempt = document.getElementById("w9_exempt").checked;
	var ssn = document.getElementById("ssn").value;
	var ein = document.getElementById("ein").value;
	var address1 = document.getElementById("address1").value;
	var address2 = document.getElementById("address2").value;
	var city = document.getElementById("city").value;
	var state = document.getElementById("state").value;
	var zip_code = document.getElementById("zip_code").value;
	var backup_withholding = document.getElementById("backup_withholding").checked;
	var signature = document.getElementById("signature").value;
	var PSID = document.getElementById("PSID").value;

	var url="w9_form.php";
	request.open("POST", url, true);
	request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	request.onreadystatechange = updatePage;
	request.send(	"&w9_name=" + escape(w9_name) +
			"&w9_business_name=" + escape(w9_business_name) +
			"&w9_type=" + escape(w9_type) +
			"&w9_other_type=" + escape(w9_other_type) +
			"&w9_exempt=" + escape(w9_exempt) +
			"&ssn=" + escape(ssn) +
			"&ein=" + escape(ein) +
			"&address1=" + escape(address1) +
			"&address2=" + escape(address2) +
			"&city=" + escape(city) +
			"&state=" + escape(state) +
			"&zip_code=" + escape(zip_code) +
			"&backup_withholding=" + escape(backup_withholding) +
			"&signature=" + escape(signature) +
			"&PSID=" + escape(PSID));
}

function getMyUploads(pn)
{
	var url="/my_uploads.php?pn=" + escape (pn);
	request.open("GET", url, true);
	request.onreadystatechange = updatePage;
	request.send(null);
}

function updatePage()
{
	if (request.readyState == 1 || request.readyState == 2 || request.readyState == 3)
	{	
		document.getElementById("myspan").innerHTML = 'Loading...'; 
	}
	if (request.readyState == 4)
	{	
		if (request.status == 200)
		{	
			var result = request.responseText; 
			document.getElementById("myspan").innerHTML = result; 
		} else {
			alert ("Error! Request status is " + request.status);
		} 
	}
}

function getMyPortfolio()
{
	if(confirm("Are you sure you want to generate a new list for my portfolio? The old portfolio will be replaced."))
	{
		/*var radioObj = document.myPortform.portfolio_type;
		var radioLength = radioObj.length;
		for (var i=0; i<radioLength; i++)
		{
			if(radioObj[i].checked)
			{
				var portfolio_type_val = radioObj[i].value;
				break;
			}
		}*/
		var obj = document.myPortform.portfolio_type;
		if (obj.options[obj.selectedIndex].value != "none") 
		{
			var portfolio_type_val = obj.options[obj.selectedIndex].value;
		}
		var PSID = document.getElementById("PSID").value;
		var url="my_portfolio.php";
		request.open("POST", url, true);
		request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		request.onreadystatechange = updatePage;
		request.send("&portfolio_type=" + escape(portfolio_type_val) +
				"&PSID=" + escape(PSID));
	}
}
/*
function getMyPortfolio_apply()
{

	var j=0;
	var i=0;
	var remove_list=new Array();
	var sort_list=new Array();
	var upload_id_list=new Array();
	
	var removeBox_length = document.myPortform.removeBox.length;
	//alert(isNaN(removeBox_length));

	if (isNaN(removeBox_length))
	{
		if(document.getElementById("removeBox").checked)
		{
			remove_list[j] = 1;
		}
	}
	else
	{
		for(i=0; i<document.myPortform.removeBox.length; i++)
		{
			if(document.myPortform.removeBox[i].checked)
			{
				remove_list[j]=document.myPortform.removeBox[i].value;
				j++;
			}
		}
	}
	for (i=0; i<document.myPortform.sort_order_box.length; i++)
	{
		sort_list[i]=document.myPortform.sort_order_box[i].value;
		upload_id_list[i]=document.myPortform.upload_id_box[i].value;
	}
	
	var url="my_portfolio.php";
	var PSID = document.getElementById("PSID").value;
	request.open("POST", url, true);
	request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	request.onreadystatechange = updatePage;
	request.send("&remove_list=" + escape(remove_list) + "&sort_list=" + escape(sort_list) + "&upload_id_list=" + escape(upload_id_list) +
				"&PSID=" + escape(PSID));
}
*/
function getMyPortfolio_apply()
{
	var sort_list=new Array();
	var upload_id_list=new Array();
	for (var i=0; i<document.myPortform.sort_order_box.length; i++)
	{
		sort_list[i]=document.myPortform.sort_order_box[i].value;
		upload_id_list[i]=document.myPortform.upload_id_box[i].value;
	}
	
	var url="my_portfolio.php";
	var PSID = document.getElementById("PSID").value;
	request.open("POST", url, true);
	request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	request.onreadystatechange = updatePage;
	request.send("&sort_list=" + escape(sort_list) + "&upload_id_list=" + escape(upload_id_list) +
				"&PSID=" + escape(PSID));
}

function getMyPortfolio_add(upload_id)
{
	var url="my_portfolio.php";
	var PSID = document.getElementById("PSID").value;
	request.open("POST", url, true);
	request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	request.onreadystatechange = updatePage;
	request.send("&upload_id_add=" + escape(upload_id)+ "&PSID=" + escape(PSID));
}

function getMyPortfolio_remove(upload_id,title)
{
	if(confirm("Are you sure you want to remove '"+title+"' from my portfolio?"))
	{
		var url="my_portfolio.php";
		var PSID = document.getElementById("PSID").value;
		request.open("POST", url, true);
		request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		request.onreadystatechange = updatePage;
		request.send("&upload_id_remove=" + escape(upload_id)+ "&PSID=" + escape(PSID));
	}
}

function getMyUploads_port(pn)
{
	var url="/my_portfolio.php?pn=" + escape (pn);
	request.open("GET", url, true);
	request.onreadystatechange = updatePage;
	request.send(null);
}
-->
