//XMLhttp variable will hold the XMLHttpRequest object
var xmlhttp = false;

// If the user is using Mozilla/Firefox/Safari/etc
if (window.XMLHttpRequest) {
   //Intiate the object
   xmlhttp = new XMLHttpRequest();
   //Set the mime type
   xmlhttp.overrideMimeType('text/xml');
}
// If the user is using IE
else if (window.ActiveXObject) {
   //Intiate the object
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}

function v_slide(el) {
   var myVerticalSlide = new Fx.Slide(el, {mode: 'vertical'});
   myVerticalSlide.toggle();
}

function h_slide(el) {
   var myHorizontalSlide = new Fx.Slide(el, {mode: 'horizontal'});
   myHorizontalSlide.toggle();
}

function h_slide2(number) {
   var total = 4;
   var el;
   var statusEl;
   var status;
   var myHorizontalSlide;
   //var result = document.getElementById("result");
   //new Event().stop();

   for (var i = 0; i < total; i++) {
      el = "horizontal_slide" + i;
      statusEl = "slide" + i + "status";
      statusEl = document.getElementById(statusEl);
      status = statusEl.innerHTML;
      myHorizontalSlide = new Fx.Slide(el, {mode: 'horizontal'});
      //result.innerHTML = result.innerHTML + "processing " +i+ "<br>";

      if (i == number) {
         //result.innerHTML = result.innerHTML + "--matches target<br>";
         //myHorizontalSlide.toggle();
         if (status == "1") {
            myHorizontalSlide.slideOut();
	    statusEl.innerHTML = 0;
	 } else {
            myHorizontalSlide.slideIn();
	    statusEl.innerHTML = 1;
	 }
      } else {
            //result.innerHTML = result.innerHTML + "--no match, should close it<br>";
            myHorizontalSlide.slideOut();
	    statusEl.innerHTML = 0;
      }
   }
}

function hide(el) {
   var myHorizontalSlide = new Fx.Slide(el, {mode: 'horizontal'});
   myHorizontalSlide.hide();
}

function vhide(el) {
   var myHorizontalSlide = new Fx.Slide(el, {mode: 'vertical'});
   myHorizontalSlide.hide();
}

function switch_style ( css_title )
{
// You may use this script on your site free of charge provided
// you do not remote this notice or the URL below. Script from
// http://www.thesitewizard.com/javascripts/change-style-sheets.shtml
  var i, link_tag ;
  for (i = 0, link_tag = document.getElementsByTagName("link") ;
    i < link_tag.length ; i++ ) {
    if ((link_tag[i].rel.indexOf( "stylesheet" ) != -1) &&
      link_tag[i].title) {
      link_tag[i].disabled = true ;
      if (link_tag[i].title == css_title) {
        link_tag[i].disabled = false ;
      }
    }
  }
}

function stripright() {
   /*
   new Fx.Move($("strip"), {
     relativeTo: $("horizontal_slide0"),
     offset: {x:0, y:350},
     duration: 2000
   }).start();
   */

   new Fx.Scroll('horizontal_slide0', {
	duration: 2500,
	offset: {'x': -200, 'y': -50}
   }).scroll.toElement('scroll2');

	//transition: Fx.Transitions.Quad.easeInOut

}

function changePic(file) {
   //file = "<img src='images/" +file+"'>";
   document.getElementById("picdiv").innerHTML = "<center><img src='Bigrotation2.gif' style='width:auto'></center>";
   var url = "printPic.php?file=" + file;
   xmlhttp.open('GET', url, true);
   xmlhttp.onreadystatechange = function() {
       if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
            document.getElementById("picdiv").innerHTML = xmlhttp.responseText;
       }
   };
   xmlhttp.send(null);
}


function imagepopup() {
   window.open ('upload2.php', 'Upload', config='height=200, width=500, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no');
}

function updateImages() {
   var url = "updateimages.php";
   xmlhttp.open('GET', url, true);
   xmlhttp.onreadystatechange = function() {
       if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
            window.opener.document.getElementById("recentimages").innerHTML = xmlhttp.responseText;
       }
    };
    xmlhttp.send(null);
}

function submitForm() {
    //make sure hidden and iframe values are in sync for all rtes before submitting form
    updateRTEs();

    //change the following line to true to submit form
    alert("rte1 = " + (document.RTEDemo.rte1.value));
    return false;
}


