// SHOW THE STRATEGY
function show(id) {
  var d = document.getElementById(id);
      //for (var i = 1; i<=10; i++) {
          if (document.getElementById('showme')) {document.getElementById('showme').style.display='none';}
      //}
  if (d) {d.style.display='block';}
}

/* Navigation elements */
thumb_foreground = new Image();
thumb_foreground_ro = new Image();
thumb_foreground_ie6 = new Image();

thumb_foreground.src="control/images/thumb_foreground.png";
thumb_foreground_ro.src="control/images/thumb_foreground_hover.png";
thumb_foreground_ie6.src="control/images/thumb_foreground.gif";

function change_body(project,item,slide) {
	var xmlHttp = get_xmlHttp();
	xmlHttp.onreadystatechange=function() {
      if(xmlHttp.readyState==4) {
		document.getElementById("showdescription").innerHTML=xmlHttp.responseText;
      }
    }
	controlstr = "/control/getimage.php?mode=description&project="+project+"&item="+item+"&slide="+slide;
    xmlHttp.open("GET",controlstr,true);
    xmlHttp.send(null);
}
function change_bodynav(project,item,slide) {
	var xmlHttp = get_xmlHttp();
	xmlHttp.onreadystatechange=function() {
      if(xmlHttp.readyState==4) {
		document.getElementById("showdescriptionnav").innerHTML=xmlHttp.responseText;
      }
    }
	controlstr = root+"/control/getimage.php?mode=descriptionnav&project="+project+"&item="+item+"&slide="+slide;
    xmlHttp.open("GET",controlstr,true);
    xmlHttp.send(null);
}
function change_projectname(project,item,slide) {
	var xmlHttp = get_xmlHttp();
	xmlHttp.onreadystatechange=function() {
      if(xmlHttp.readyState==4) {
		document.getElementById("projectname").innerHTML=xmlHttp.responseText;
      }
    }
	controlstr = root+"/control/getimage.php?mode=projectname&project="+project+"&item="+item+"&slide="+slide;
    xmlHttp.open("GET",controlstr,true);
    xmlHttp.send(null);
}
function change_slidemarker(project,item,slide) {
	var xmlHttp = get_xmlHttp();
	xmlHttp.onreadystatechange=function() {
      if(xmlHttp.readyState==4) {
		document.getElementById("slidemarker").innerHTML=xmlHttp.responseText;
      }
    }
	controlstr = root+"/control/getimage.php?mode=slidemarker&project="+project+"&item="+item+"&slide="+slide;
    xmlHttp.open("GET",controlstr,true);
    xmlHttp.send(null);
}
// Edey FX - load image
function get_image(project,item,slide)
{
	change_body(project,item,slide);
	change_bodynav(project,item,slide);
    change_projectname(project,item,slide);
    change_slidemarker(project,item,slide);
	var xmlHttp = get_xmlHttp();
	xmlHttp.onreadystatechange=function() {
      if(xmlHttp.readyState==4) {
		document.getElementById("showimage").innerHTML=xmlHttp.responseText;
      }
    }
	controlstr = root+"/control/getimage.php?mode=image&project="+project+"&item="+item+"&slide="+slide;
    xmlHttp.open("GET",controlstr,true);
    xmlHttp.send(null);
}
// MINIBOARD
// Change Ad 
function change_ad(ad_id, image_id) {
	var xmlHttp = get_xmlHttp();
	xmlHttp.onreadystatechange=function() {
      if(xmlHttp.readyState==4) {
		document.getElementById("large_ad_image").innerHTML=xmlHttp.responseText;
      }
    }
	controlstr = "control/change_ad.php?ad_id="+ad_id+"&image_num="+image_id;
    xmlHttp.open("GET",controlstr,true);
    xmlHttp.send(null);
}

// This function will return a XMLHttp connection
function get_xmlHttp () {
  var xmlHttp;
  try { // Firefox, Opera 8.0+, Safari   
		xmlHttp=new XMLHttpRequest(); }
  catch (e) { // Internet Explorer    
	try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); }
    catch (e) {
		try { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); }
    catch (e) { 
		alert("Your browser does not support AJAX!");
		return false;  
	}}}
	return xmlHttp;
}

