// JavaScript Document
window.onload = function(){
	//fix_height();
}
window.onresize = function(){
	//fix_height();
}
function fix_height() {
	var winWidth, winHeight, d=document;
	if (typeof window.innerWidth!='undefined') {
		winWidth = window.innerWidth;
		winHeight = window.innerHeight;
	} else if ( d.documentElement
	&& typeof d.documentElement.clientWidth!='undefined'
	&& d.documentElement.clientWidth!=0 ) {
		winWidth = d.documentElement.clientWidth;
		winHeight = d.documentElement.clientHeight;
	} else if ( d.body
	&& typeof d.body.clientWidth!='undefined') {
		winWidth = d.body.clientWidth;
		winHeight = d.body.clientHeight;
	}
	//int_body = document.getElementById("body").offsetHeight;
	//int_filler = document.getElementById("filler").offsetHeight;
	//int_footer = document.getElementById("footer").offsetHeight;
	//int_total=int_body+int_footer;
	//int_remaining=winHeight-(int_total);
}
function showCredits(){
	if(document.getElementById('info')){
		var theElement = document.getElementById('info');
		if(theElement.style.display == "block"){
      		theElement.style.display = "none";
   		}else{
			theElement.style.display = "block";
		}
	}
}
function showImageInfo(){
	if(document.getElementById('image_info')){
		var theElement = document.getElementById('image_info');
		if(theElement.style.display == "block"){
      		theElement.style.display = "none";
   		}else{
			theElement.style.display = "block";
		}
	}
}
function setText(id,str_text){
	if(document.getElementById(id)){
		var theElement = document.getElementById(id);
		theElement.innerHTML=str_text;
	}
}
function saveOrder(){
	str_order=document.getElementById('order').value;
	self.location.href="/inc/scr_save_order.php?order="+str_order;
}
function updateLargeImage(catid,setid,id,linkId,title,width,page){
		updateState(linkId,title,width);
		document.getElementById('image').value = id;
		
		var ajaxRequest;  // The variable that makes Ajax possible!
		 try{
		   // Opera 8.0+, Firefox, Safari
		   ajaxRequest = new XMLHttpRequest();
		  // alert('Opera 8.0+, Firefox, Safari');
		 }catch (e){
		   // Internet Explorer Browsers
		   try{
			  ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
			  //alert('Msxml2.XMLHTTP');
		   }catch (e) {
			  try{
				 ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
				 //alert('Microsoft.XMLHTTP');
			  }catch (e){
				 // Something went wrong
				 alert("Your browser broke!");
				 return false;
			  }
		   }
		 }
		 // Create a function that will receive data 
		 // sent from the server and will update
		 // div section in the same page.
		 ajaxRequest.onreadystatechange = function(){
		 //alert(ajaxRequest.readyState);
		   if(ajaxRequest.readyState == 4){
			   if(ajaxRequest.status  == 200) {
					document.getElementById("large_image_holder").innerHTML=ajaxRequest.responseText;
					  }else {
				 }
		   }
		 }
		ajaxRequest.open("GET", "/inc/scr_large_image.php?catid="+catid+"&setid="+setid+"&id="+id+"&slot="+linkId+"&page="+page, true);
		ajaxRequest.send(null);
}

function deleteImage(image){
			
		var ajaxRequest;  // The variable that makes Ajax possible!
		 try{
		   // Opera 8.0+, Firefox, Safari
		   ajaxRequest = new XMLHttpRequest();
		  // alert('Opera 8.0+, Firefox, Safari');
		 }catch (e){
		   // Internet Explorer Browsers
		   try{
			  ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
			  //alert('Msxml2.XMLHTTP');
		   }catch (e) {
			  try{
				 ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
				 //alert('Microsoft.XMLHTTP');
			  }catch (e){
				 // Something went wrong
				 alert("Your browser broke!");
				 return false;
			  }
		   }
		 }
		 // Create a function that will receive data 
		 // sent from the server and will update
		 // div section in the same page.
		 ajaxRequest.onreadystatechange = function(){
		 //alert(ajaxRequest.readyState);
		   if(ajaxRequest.readyState == 4){
			   if(ajaxRequest.status  == 200) {
					document.getElementById("lightbox_thumb_holder").innerHTML=ajaxRequest.responseText;
					alert(ajaxRequest.responseText);
					  }else {
				 }
		   }
		 }
		ajaxRequest.open("GET", "/inc/scr_delete_lightbox_image.php?image="+image, true);
		ajaxRequest.send(null);
}

function page(setid,num,str_item){
		//alert(document.getElementById('image').value);
		var image;
		image = document.getElementById('image').value;
		//image = document.frm_hidden.image.value;
		var ajaxRequest;  // The variable that makes Ajax possible!
		 try{
		   // Opera 8.0+, Firefox, Safari
		   ajaxRequest = new XMLHttpRequest();
		  // alert('Opera 8.0+, Firefox, Safari');
		 }catch (e){
		   // Internet Explorer Browsers
		   try{
			  ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
			  //alert('Msxml2.XMLHTTP');
		   }catch (e) {
			  try{
				 ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
				 //alert('Microsoft.XMLHTTP');
			  }catch (e){
				 // Something went wrong
				 alert("Your browser broke!");
				 return false;
			  }
		   }
		 }
		 // Create a function that will receive data 
		 // sent from the server and will update
		 // div section in the same page.
		 ajaxRequest.onreadystatechange = function(){
		 //alert(ajaxRequest.readyState);
		   if(ajaxRequest.readyState == 4){
			   if(ajaxRequest.status  == 200) {
					document.getElementById("small_images_holder").innerHTML=ajaxRequest.responseText;
					//alert(ajaxRequest.responseText);
					  }else {
				 }
		   }
		 }
		ajaxRequest.open("GET", "/inc/scr_small_images.php?setid="+setid+"&page="+num+"&item="+str_item+"&image="+image, true);
		ajaxRequest.send(null);
}

function showContent(str_type){
	if(str_type=="bio"){
		document.getElementById("bio_text").style.display="block";
		document.getElementById("client_list_text").style.display="none";
		document.getElementById("links_text").style.display="none";
	}else if(str_type=="clients"){
		document.getElementById("bio_text").style.display="none";
		document.getElementById("client_list_text").style.display="block";
		document.getElementById("links_text").style.display="none";
	}else if(str_type=="links"){
		document.getElementById("bio_text").style.display="none";
		document.getElementById("client_list_text").style.display="none";
		document.getElementById("links_text").style.display="block";
	}
}

function setContent(str_type){
		
		var ajaxRequest;  // The variable that makes Ajax possible!
		 try{
		   // Opera 8.0+, Firefox, Safari
		   ajaxRequest = new XMLHttpRequest();
		  // alert('Opera 8.0+, Firefox, Safari');
		 }catch (e){
		   // Internet Explorer Browsers
		   try{
			  ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
			  //alert('Msxml2.XMLHTTP');
		   }catch (e) {
			  try{
				 ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
				 //alert('Microsoft.XMLHTTP');
			  }catch (e){
				 // Something went wrong
				 alert("Your browser broke!");
				 return false;
			  }
		   }
		 }
		 // Create a function that will receive data 
		 // sent from the server and will update
		 // div section in the same page.
		 ajaxRequest.onreadystatechange = function(){
		 //alert(ajaxRequest.readyState);
		   if(ajaxRequest.readyState == 4){
			   if(ajaxRequest.status  == 200) {
					document.getElementById("text").innerHTML=ajaxRequest.responseText;
					//alert(ajaxRequest.responseText);
					  }else {
				 }
		   }
		 }
		ajaxRequest.open("GET", "/inc/scr_get_content.php?type="+str_type, true);
		ajaxRequest.send(null);
}

function addLightbox(id){
		
		var ajaxRequest;  // The variable that makes Ajax possible!
		 try{
		   // Opera 8.0+, Firefox, Safari
		   ajaxRequest = new XMLHttpRequest();
		  // alert('Opera 8.0+, Firefox, Safari');
		 }catch (e){
		   // Internet Explorer Browsers
		   try{
			  ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
			  //alert('Msxml2.XMLHTTP');
		   }catch (e) {
			  try{
				 ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
				 //alert('Microsoft.XMLHTTP');
			  }catch (e){
				 // Something went wrong
				 alert("Your browser broke!");
				 return false;
			  }
		   }
		 }
		 // Create a function that will receive data 
		 // sent from the server and will update
		 // div section in the same page.
		 ajaxRequest.onreadystatechange = function(){
		 //alert(ajaxRequest.readyState);
		   if(ajaxRequest.readyState == 4){
			   if(ajaxRequest.status  == 200) {
					//document.getElementById("small_images_holder").innerHTML=ajaxRequest.responseText;
					document.getElementById("lightbox_link").innerHTML=ajaxRequest.responseText;
					//alert(ajaxRequest.responseText);
					  }else {
				 }
		   }
		 }
		ajaxRequest.open("GET", "/inc/scr_add_lightbox.php?int_image_id="+id, true);
		ajaxRequest.send(null);
}

function updateState(id,title,width){
	for(int=0;int<8;int++){
		 if(document.getElementById('item_link'+int)){
		    var theElement = document.getElementById('item_link'+int);
		    theElement.className = "up";
			theElement.innerHTML="&nbsp;";
		 }
	}
	if(document.getElementById(id)){
		var theElement = document.getElementById(id);
		theElement.className = "down";
		theElement.innerHTML="<img src=\"/sitepix/structural/sr_cross_01.png\" width=\""+width+"\" height=\"62\"/>";
	}
}