// AJAX implementation 
var xmlhttp = false;
var loadedobjects="";

try{
	//if javascript version is greater than 5 (current)
	xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}catch (e){
	//if not then we must be using the older activex object
	try{
	xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	} catch (E) {
		//Else we must be using something other than IE (which means it's a browswer that doesn't suck)
		xmlhttp = false;
	}
}

//Create a javascript instance, the way it should be
if(!xmlhttp && typeof XMLHttpRequest != 'undefined'){
	xmlhttp = new XMLHttpRequest();
}

function makerequest(serverPage, objID){
	var obj = document.getElementById(objID);
	xmlhttp.open("GET", serverPage, true);
	xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
			obj.innerHTML = xmlhttp.responseText;
		}
	}
	xmlhttp.send(null);
}

function slider(){
		$("#slider").easySlider({
			prevText: 'Previous Testimonial',
			nextText: 'Next Testimonial',		
			vertical: true, 
			continuous: true 		
		});
}

function adjustbody(setclass){
	document.body.className=setclass;
}

function thelegendarylightbox(){
        $('#mainFrame a').lightBox();
}

function makerequestform(serverPage, objID){
	var obj = document.getElementById(objID);
	xmlhttp.open("GET", serverPage, true);
	xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
			obj.innerHTML = xmlhttp.responseText;
			slider();
		}
	}
	xmlhttp.send(null);
}

function makerequestGallery(serverPage, objID){
	var obj = document.getElementById(objID);
	xmlhttp.open("GET", serverPage, true);
	xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
			obj.innerHTML = xmlhttp.responseText;
			thelegendarylightbox();
		}
	}
	xmlhttp.send(null);
}




function loadjscssfile(filename, filetype){
 if (filetype=="js"){ //if filename is a external JavaScript file
  var fileref=document.createElement('script')
  fileref.setAttribute("type","text/javascript")
  fileref.setAttribute("src", filename)
 }
 else if (filetype=="css"){ //if filename is an external CSS file
  var fileref=document.createElement("link")
  fileref.setAttribute("rel", "stylesheet")
  fileref.setAttribute("type", "text/css")
  fileref.setAttribute("href", filename)
 }
 if (typeof fileref!="undefined")
  document.getElementsByTagName("head")[0].appendChild(fileref)
}


function transmitaname(objID, serverPage){
	var theinput = document.getElementById("testinput_xml");
  if (theinput.value==null||theinput.value=="")	{
		alert('You must enter an artist to continue.');
		return false;
    }
  else
    {
	var obj = document.getElementById(objID);
	xmlhttp.open("GET", serverPage+'?artistname='+theinput.value+'&depart=ba');
	xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
			obj.innerHTML = xmlhttp.responseText;
		}
    return false;
    }
	xmlhttp.send(null);
	return false;
}
}


function describe(theoption){
	var index0 = theoption.selectedIndex;
	var br = 'The Bronze package will supply you with the contact information exclusively.';
	var si = 'The Silver package will supply you with the contact information as well as direct email support from our team!';
	var vip = 'Not sure how to speak with your purchased contact?  Get VIP status!  Our team will personally faciliate your attempt to make contact!';
	var obj = document.getElementById('describe');
	switch(index0){
		case 0:
			obj.innerHTML = br;
			break;
		case 1:
			obj.innerHTML = si;
			break;
		case 2:
			obj.innerHTML = vip;
			break;
		default:
			obj.innetHTML = br;
	}
}
