// $Header: /usr/local/cvsroot/studentcity.com/_assets/js/sc.js,v 1.10 2004/12/03 19:08:28 jreese Exp $
//
// StudentCity.Com JavaScript
// -MB

function pricebuster_popup(url) {
	window.open('/pricebuster.php','popup','height=300,width=400');	
}

function info_popup(id,title) {
	window.open("/paa_pop.php?id="+id+"&title="+title,"_blank","scrollbars=yes,resizeable=yes,height=270,width=415,top=" + ((screen.height/2) - 135) + ",left=" + ((screen.width/2) - 200));
}

function supp_popup(suppID) {
	window.open("/supp_popup.php?suppID="+suppID,"_blank","toolbar=No,menubar=No,location=No,scrollbars=yes,resizable=Yes,status=Yes,width=400,height=400,left=250,top=175");
}

// email_page()
// this function opens a popup window containing the email_this_page form
function email_page(url) {
	window.open("/email_page.php?email_url=" + url +"","_blank","height=270,width=400,top=" + ((screen.height/2) - 135) + ",left=" + ((screen.width/2) - 200));
}

function video_pop(video) {
	window.open("/video_popup.php?video=" + video, "video","top=" + ((screen.height/2)-140) + ",left=" + ((screen.width/2)-120) + ",height=180,width=240,scrollbars=no,resizable=yes");
}

// remaining_chars()
// This function keeps track of the remaining characters in the 'extra nots'
// box on the email_this_page form and prints them in the special box
// on the bottom of the form...
function remaining_chars(form) {
	document.email_this_page.remaining_chars.value=(255 - (document.email_this_page.email_note.value.length));
}

// verify_email_form()
// This function verifies that all required fields in the email_this_page
// form are filled. If so, it submits the form..
function verify_email_form(form) {

	if (form.from_name.value.length <= 0) {
		window.alert("Please enter your name");
		return 1;
	}
	if (form.from_email.value.length <= 0) {
		window.alert("Please enter your email");
		return 1;
	}
	if (form.to_name.value.length <= 0) {
		window.alert("Please enter recipients name");
		return 1;
	}
	if (form.to_email.value.length <= 0) {
		window.alert("Please enter recipients email");
		return 1;
	}
	
	form.submit();
}
