							var img1 = new Image();img1.src = "/shared_code/images/site/main/invite1.jpg";
							var img2 = new Image();img2.src = "/shared_code/images/site/main/invite2.jpg";
							var img3 = new Image();img3.src = "/shared_code/images/site/main/invite3.jpg";
							var img4 = new Image();img4.src = "/shared_code/images/site/main/invite4.jpg";
							var img5 = new Image();img5.src = "/shared_code/images/site/main/invite5.jpg";
							var img6 = new Image();img6.src = "/shared_code/images/site/main/invite6.jpg";

notlisted = function (contents) {
 if (contents == "") {
 document.getElementById("collegeID").value = 0;
 document.getElementById("collegeText").value = "My school is not listed";
 }
}

function validayshun()
{
    var rv=1;
	var fieldMsg = "";
    if(!document.emailForm.sendersName.value)
	{
		rv=0;
		fieldMsg += "Your Name";
	}
	
    if(!document.emailForm.sendersEmail.value)
	{
		rv=0;
		if (fieldMsg.length > 0) fieldMsg += ",";
		fieldMsg += "Your Email Address";
	}
    if(!document.emailForm.emails.value)
	{
		rv=0;
		if (fieldMsg.length > 0) fieldMsg += ",";
		fieldMsg += "Friends Email Addresses";
	}
    if(rv == 0) 
	{
		alert('Please complete the form, the following fields are missing:\n' + fieldMsg);
		return false;
    } 
	else 
	{
		document.emailForm.submit();
		return true;
    }

}

function validateGroupRequest(){
		var rv=1;
		var fieldMsg = "";
		if(!document.GROUPS.Fname.value){
			rv=0;
			fieldMsg += "First Name";
		}	
		if(!document.GROUPS.Lname.value){
			rv=0;
			if (fieldMsg.length > 0) fieldMsg += ", ";
			fieldMsg += "Last Name"
		}
/*		if(!document.GROUPS.City.value){
			rv=0;
			if (fieldMsg.length > 0) fieldMsg += ", ";
			fieldMsg += "City"
		}
		if(document.GROUPS.State.selectedIndex==0){
			rv=0;
			if (fieldMsg.length > 0) fieldMsg += ", ";
			fieldMsg += "State"
		}
*/		
		if(echeck(document.GROUPS.Email.value)==false){
			rv=0;
			if (fieldMsg.length > 0) fieldMsg += ", ";
			fieldMsg += "Email"
		}
	
		 if(!document.GROUPS.Phone.value){
			rv=0;
			if (fieldMsg.length > 0) fieldMsg += ", ";
			fieldMsg += "Phone Number"
		}
	
		if(rv == 0) {
			alert('Please complete the form, the following fields are missing:\n' + fieldMsg);
			return false;
		} else {
			/* ajax done with prototype.js */
//			submitGroupForm();
//			return false;
			return true;
		}
	
	}
	
	function submitGroupFormResponse(originalRequest) {
		$('responseContainer').innerHTML = originalRequest.responseText;
		$('groupRequestForm').reset();
		$('responseContainer').show();
	}
	
	function submitGroupForm(){
		var url = "/college_spring_break/groupsProcess.php";
		var pars = Form.serialize("groupRequestForm");
		var myAjax = new Ajax.Request(url, {method: 'get', parameters:pars, onComplete: submitGroupFormResponse});
		return false;
	}
	
	
	function validateSendMeInformation(){
		var rv=1;
		var fieldMsg = "";

		if(document.INFO.checkImage.value == 1){	
			var checkImageValue = "sPrinG";
		} else if(document.INFO.checkImage.value == 2){	
			var checkImageValue = "CANcun";
		} else if(document.INFO.checkImage.value == 3){	
			var checkImageValue = "aCaPulco";
		} else if(document.INFO.checkImage.value == 4){	
			var checkImageValue = "JamAica";
		} else if(document.INFO.checkImage.value == 5){	
			var checkImageValue = "BAhamas";
		}

		if(document.INFO.checkImageText.value != checkImageValue){	
			alert('Please Reenter Image Text:' + checkImageValue );
			return false;
		}

		if(!document.INFO.Fname.value){
			rv=0;
			fieldMsg += "First Name";
		}	
		if(!document.INFO.Lname.value){
			rv=0;
			if (fieldMsg.length > 0) fieldMsg += ", ";
			fieldMsg += "Last Name"
		}
		
		/*if(!document.INFO.Add1.value){
			rv=0;
			if (fieldMsg.length > 0) fieldMsg += ", ";
			fieldMsg += "Address"
		}
		
		if(!document.INFO.City.value){
			rv=0;
			if (fieldMsg.length > 0) fieldMsg += ", ";
			fieldMsg += "City"
		}*/

		if(document.INFO.State.selectedIndex==0){
			rv=0;
			if (fieldMsg.length > 0) fieldMsg += ", ";
			fieldMsg += "State"
		}
	
		/*if(!document.INFO.Zip.value){
			rv=0;
			if (fieldMsg.length > 0) fieldMsg += ", ";
			fieldMsg += "Zip Code"
		}*/
		
		if (echeck(document.INFO.Email.value)==false){
			rv=0;
			if (fieldMsg.length > 0) fieldMsg += ", ";
			fieldMsg += "Email Address"
		}
		
		if(rv == 0) {
			alert('Please complete the form, the following fields are missing:\n' + fieldMsg);
			return false;
		} else {
//			submitSendMeInformationForm();
//			return false;
			return true;
		}
	
	}
	
	function validateMiniSendMeInformation(){
		var rv=1;
		var fieldMsg = "";

		if(!document.INFO.Fname.value || document.INFO.Fname.value=="First Name"){
			document.INFO.Fname.value="";
		}	
		if(!document.INFO.Lname.value || document.INFO.Lname.value=="Last Name"){
			document.INFO.Lname.value="";
		}
		if (echeck(document.INFO.Email.value)==false || document.INFO.Email.value=="Email"){
			document.INFO.Email.value="";
		}
		if(!document.INFO.Phone.value || document.INFO.Phone.value=="Phone"){
			document.INFO.Phone.value="";
		}
		
		return true;
	}
	
	function submitSendMeInformationFormResponse(originalRequest) {
		$('responseContainer').innerHTML = originalRequest.responseText;
		$('sendMeInformationForm').reset();
		$('responseContainer').show();
	}
	
	function submitSendMeInformationForm(){
		var url = "/college_spring_break/sendMeInformationProcess.php";
		var pars = Form.serialize("sendMeInformationForm");
		var myAjax = new Ajax.Request(url, {method: 'get', parameters:pars, onComplete: submitSendMeInformationFormResponse});
		return false;
	}
	
	function toggleJobs(contentToToggle, toggler){
		if($(toggler).className == "toggleUp"){
			$(toggler).className = "toggleDown";
		}else{
			$(toggler).className = "toggleUp";
		}

		toggle(contentToToggle);
	}
	
	//you must include prototype js lib for the $ function
	function toggle(toggleVar){
		obj = $(toggleVar);
		obj.style.display = ((obj.style.display == "") ? "none" : "");
	}


	function showText(id){
		var obj = document.getElementById(id);
			obj.style.display = "";
	}

	function showItem(id){
		var obj = document.getElementById(id);
			obj.style.display = "";
	}
	
	function viewReferred(id){
		var obj = document.getElementById(id);
		
		
			obj.style.display = "";
	}	
	
	function hideItem(id){
		var obj = document.getElementById(id);
			obj.style.display = "none";
	}			
		
	function generateTabs(){
	$$('.tabs').each(function(tabs){
		new Control.Tabs(tabs);
		});
	}

function ajaxinit  (e,obj) {
    var oACDS;
    var oAutoComp;
	
	oACDS = new YAHOO.widget.DS_XHR("/college_spring_break/ajaxReturn.php", obj.schema );
	oACDS.scriptQueryAppend = "field=" + obj.field;

	oAutoComp = new YAHOO.widget.AutoComplete(obj.input,obj.container, oACDS);
	oAutoComp.useShadow = true;
	oAutoComp.useIFrame = true;
	oAutoComp.forceSelection = true;	
	oAutoComp.typeAhead =  false;
	oAutoComp.queryDelay = 0;
	if (obj.format) {
		oAutoComp.formatResult = obj.format;
	}
	if (obj.id) {
		oAutoComp.itemSelectEvent.subscribe(selectItem,obj.id,obj.param); 
	}


	oAutoComp.doBeforeExpandContainer = function(oTextbox, oContainer, sQuery, aResults) {
		var pos = YAHOO.util.Dom.getXY(oTextbox);
		pos[1] += YAHOO.util.Dom.get(oTextbox).offsetHeight;
		YAHOO.util.Dom.setXY(oContainer,pos);
		return true;
	};
	
}


function selectItem ( oSelf , elItem , hiddenID, hiddenParam) {
	var result = elItem.pop();
	var id = result.pop();
	document.getElementById(hiddenID).value = id;
	if (hiddenParam != null) {
		var param = result.pop();
		document.getElementById(hiddenParam).value = param;
	}
}

var college = new Object();
college.schema = ["collegeResult","College","City","State","TableID"];
college.field = "college";
college.input = "collegeText";
college.container = "collegeContainer";
college.id = "collegeID";
college.format = function(oResultItem) {
		return oResultItem[0]  + " (" + oResultItem[1] + ", " + oResultItem[2] + ")";
	};


var greek = new Object();
greek.schema = ["greekResult","Name","tempfield","TID"];
greek.field = "greek";
greek.input = "greekText";
greek.container = "greekContainer";
greek.id = "greekID";
greek.param = "greekParam";
//YAHOO.util.Event.addListener(this,"load",init,greek);



function echeck(str) {

		var at="@";
		var dot=".";
		var lat=str.indexOf(at);
		var lstr=str.length;
		var ldot=str.indexOf(dot);
		if (str.indexOf(at)==-1){
		   return false;
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   return false;
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		     return false;
		}

		if (str.indexOf(at,(lat+1))!=-1){
			return false;
		}
		
		if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
			return false;
		}
		
		if (str.indexOf(dot,(lat+2))==-1){
			return false;
		}
		
		if (str.indexOf(" ")!=-1){
			return false;
		}

 		 return true;				
	}


function collegeNotListed(contents) {
	if (contents == "") {
		document.getElementById("collegeID").value = 0;
		document.getElementById("collegeText").value = "My school is not listed";
	}
}

function greekNotListed(contents) {
	if (contents == "") {
		document.getElementById("greekID").value = 0;
		document.getElementById("greekText").value = "My house is not listed";
	}
}

