function country_redirect() {
	var w = document.form1.country.options[document.form1.country.selectedIndex].value;
	if (w == "Other") {
		change_confirm = confirm("CEA is currently not accepting students from your selected country. To view other study abroad programs which are, please click OK to be redireted to StudyAbroad360.com.");
		if(change_confirm == true) {
			window.location.href="http://www.StudyAbroad360.com";
			return true;
		} else {
			document.form1.country.value = "USA";
		}
	}
	return;
}

function fetchPrograms() {
	var arguments = new Object;
	arguments.trigger = 'location';
	arguments.output = output = 'output_programs';
	arguments.content = document.getElementById(arguments.trigger).value;
	arguments.pid = '';
	arguments.css = '';
	
	//http.open("GET", "http://college.us.com/s/cuscom/ajaxlib/generator.php?args=" + escape(associate(arguments)) + "&time=" + time(), true);

	http.onreadystatechange = handleHttpResponse;
	http.send(null);
}

function getElementsByClassName(classname, node)  {
	if(!node) node = document.getElementsByTagName("body")[0];
    var a = [];
    var re = new RegExp('\\b' + classname + '\\b');
    var els = node.getElementsByTagName("*");
    for(var i=0,j=els.length; i<j; i++)
        if(re.test(els[i].className))a.push(els[i]);
    return a;
}


function updateContent(newId) {
	var theClass = 'content';
	var allPageTags = new Array();
	
	//Populate the array with all the page tags
	var allPageTags=document.getElementsByTagName("*");
	
	//Cycle through the tags using a for loop
	for (i=0; i<allPageTags.length; i++) {
		//Pick out the tags with our class name
		if (allPageTags[i].className==theClass) {
			//Manipulate this in whatever way you want
			allPageTags[i].style.display='none';
		}
	}
	if (newId!='company') {
		show('back-link');
	} else {
		hide('back-link');
	}
	show(newId);
}

function updatePhoto(newId) {
	var theClass = 'photo';
	var allPageTags = new Array();
	
	
	//Populate the array with all the page tags
	var allPageTags=document.getElementsByTagName("*");
	
	//Cycle through the tags using a for loop
	for (i=0; i<allPageTags.length; i++) {
		//Pick out the tags with our class name
		if (allPageTags[i].className==theClass) {
			//Manipulate this in whatever way you want
			allPageTags[i].style.display='none';
		}
	}	
	show(newId);
	return false;
}

function updateInstitutions() {
	var newId = document.form1.state_of_institution.value;
	//alert('test');
	var theClass = 'institutions';
	var allPageTags = new Array();
	
	//Populate the array with all the page tags
	var allPageTags=document.getElementsByTagName("*");
	
	//Cycle through the tags using a for loop
	for (i=0; i<allPageTags.length; i++) {
		//Pick out the tags with our class name
		if (allPageTags[i].className==theClass) {
			//Manipulate this in whatever way you want
			allPageTags[i].style.display='none';
		}
	}	
	show(newId);
}


function show(n) {
document.getElementById(n).style.display = "block";
}

function hide(n) {
document.getElementById(n).style.display = "none";
}
