var px ="px";
var index = 0;

function ajaxManager()
	{
	var args = ajaxManager.arguments;
	var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();
	switch (args[0])
		{
		case "array_setup":
			content1Array = new Array();
			content1Array[0] = "includes/sc2_info.php";
			content1Array[1] = "includes/sc4_info.php";
			content1Array[2] = "includes/sc8_info.php";
			content1Array[3] = "includes/sc1_info.php";
			content1Array[4] = "includes/sc5_info.php";
			content1Array[5] = "includes/sc3_info.php"; 
			content1Array[6] = "includes/sc9_info.php";
			content1Array[7] = "includes/sc7_info.php"; 
			content1Array[8] = "includes/sc6_info.php";     
						
			content2Array = new Array();
			content2Array[0] = "includes/sc2_left.php";
			content2Array[1] = "includes/sc4_left.php";
			content2Array[2] = "includes/sc8_left.php"; 
			content2Array[3] = "includes/sc1_left.php";
			content2Array[4] = "includes/sc5_left.php";
			content2Array[5] = "includes/sc3_left.php";
			content2Array[6] = "includes/sc9_left.php";
			content2Array[7] = "includes/sc7_left.php";
			content2Array[8] = "includes/sc6_left.php";
						
			scimageArray = new Array();
			scimageArray[0] = "includes/feature_2.html";
			scimageArray[1] = "includes/feature_4.html";	
			scimageArray[2] = "includes/feature_8.html";	
			scimageArray[3] = "includes/feature_1.html";
			scimageArray[4] = "includes/feature_5.html";	
			scimageArray[5] = "includes/feature_3.html";	
			scimageArray[6] = "includes/feature_9.html";
			scimageArray[7] = "includes/feature_7.html";	
			scimageArray[8] = "includes/feature_6.html";	
			
					
			left_imageArray = new Array();
			left_imageArray[0] = "includes/left_image_2.html";
			left_imageArray[1] = "includes/left_image_4.html";	
			left_imageArray[2] = "includes/left_image_8.html";	  
			left_imageArray[3] = "includes/left_image_1.html";
			left_imageArray[4] = "includes/left_image_5.html";	
			left_imageArray[5] = "includes/left_image_3.html";
			left_imageArray[6] = "includes/left_image_9.html";
			left_imageArray[7] = "includes/left_image_7.html";	
			left_imageArray[8] = "includes/left_image_6.html";	
		/*	NUMBER_IMAGS = new Array();
			NUMBER_IMAGS[0] = "images/cs_thumb1_3.png";
			NUMBER_IMAGS[1] = "images/cs_thumb2_3.png";
			NUMBER_IMAGS[2] = "images/cs_thumb3_3.png";
			NUMBER_IMAGS[3] = "images/cs_thumb4_3.png";
			NUMBER_IMAGS[4] = "images/cs_thumb5_3.png";
			NUMBER_IMAGS[5] = "images/cs_thumb6_3.png";
			NUMBER_IMAGS[6] = "images/cs_thumb7_3.png";
			NUMBER_IMAGS[7] = "images/cs_thumb8_3.png";		
			
			SRC_IMAGS = new Array();
			SRC_IMAGS[0] = "images/cs_thumb1_3.png";
			SRC_IMAGS[1] = "images/cs_thumb2_3.png";
 			SRC_IMAGS[2] = "images/cs_thumb3_3.png";
 			SRC_IMAGS[3] = "images/cs_thumb4_3.png";
 			SRC_IMAGS[4] = "images/cs_thumb5_3.png";
	   		SRC_IMAGS[5] = "images/cs_thumb6_3.png";
 			SRC_IMAGS[6] = "images/cs_thumb7_3.png";
 			SRC_IMAGS[7] = "images/cs_thumb8_3.png";  */
			break;			
		case "load_page":
			if (x)
				{
				x.onreadystatechange = function()
					{
					if (x.readyState == 4 && x.status == 200)
						{
						el = document.getElementById(args[2]);
						el.innerHTML = x.responseText;		
						new Effect.Appear('pic', {duration:1.0, from:0.0, to:1.0});
						}
					}
				x.open("GET", args[1], true);
				x.send(null);
				}
			break; 	
			case "disArw":
			if (x)
				{
				x.onreadystatechange = function()
					{
					if (x.readyState == 4 && x.status == 200)
						{
						el = document.getElementById(args[2]);
						el.innerHTML = x.responseText;		
						}
					}
				x.open("GET", args[1], true);
				x.send(null);
				}
			break;  
				case "load_page1":
			if (document.getElementById)
				{ 
				//document.getElementById("contentLYR").style.left = 0+px;	
				//document.cs_thumb1.src = ("images/cs_thumb1_2.png"); 
				}
			if (x)
				{
				x.onreadystatechange = function()
					{
					if (x.readyState == 4 && x.status == 200)
						{
						el = document.getElementById(args[2]);
						el.innerHTML = x.responseText;		
					//glideContent2();	
					}
					}
				x.open("GET", args[1], true);
				x.send(null);
				}
			break; 
		case "load_page2":
			if (x)
				{
				x.onreadystatechange = function()
					{
					if (x.readyState == 4 && x.status == 200)
						{
						el = document.getElementById(args[2]);
						el.innerHTML = x.responseText;		
					setTimeout('new Effect.SlideDown((document.getElementById(\'dropn\')),{duration:0.3})' , 500);
					}
					}
				x.open("GET", args[1], true);
				x.send(null);
				}
			break;	
				case "load_page3":
			if (x)
				{
				x.onreadystatechange = function()
					{
					if (x.readyState == 4 && x.status == 200)
						{
						el = document.getElementById(args[2]);
						el.innerHTML = x.responseText;	
						new Effect.SlideDown((document.getElementById('dropn')),{duration:0.3});	
						}
					}
				x.open("GET", args[1], true);
				x.send(null);
				}
			break;	
			
		case "sc_img":
			if (x)
				{
				x.onreadystatechange = function()
					{
					if (x.readyState == 4 && x.status == 200)
						{
						el = document.getElementById(args[2]);
						el.innerHTML = x.responseText;		
					   initGlide2();
					}
					}
				x.open("GET", args[1], true);
				x.send(null);
				}
			break;		
		case "sc_img2":
			if (x)
				{
				x.onreadystatechange = function()
					{
					if (x.readyState == 4 && x.status == 200)
						{
						el = document.getElementById(args[2]);
						el.innerHTML = x.responseText;		
						new Effect.MoveBy((document.getElementById('glideDiv')).parentNode, 0, 100 , {duration: 0.5,  transition: Effect.Transitions.slowstop});
						}  
					}
				x.open("GET", args[1], true);
				x.send(null);
				}
			break;	
			case "gld":
			if (x)
				{
				x.onreadystatechange = function()
					{
					if (x.readyState == 4 && x.status == 200)
						{
						el = document.getElementById(args[2]);
						el.innerHTML = x.responseText;		
						initGlide();
					}
					}
				x.open("GET", args[1], true);
				x.send(null);
				}
			break;	
			case "gld2":
			if (x)
				{
				x.onreadystatechange = function()
					{
					if (x.readyState == 4 && x.status == 200)
						{
						el = document.getElementById(args[2]);
						el.innerHTML = x.responseText;		
						initGlide2();
					}
					}
				x.open("GET", args[1], true);
				x.send(null);
				}
			break;		
			case "SCone":
			index=0; 
			ajaxManager('load_page', content1Array[index], 'column1LYR');  
			ajaxManager('disArw', content2Array[index], 'column2LYR');	 
			ajaxManager('gld', scimageArray[index], 'glideDiv');
			ajaxManager('load_page3', left_imageArray[index], 'dropn');	
			//document.cs_thumb1.src = ("images/cs_thumb1_3.png");   
			//setTimeout('changeImg(1)', 650);
			//changeImg(1); 
			changeImag(1);
			break;	 	   
			case "SCtwo":				
			index=1; 
			ajaxManager('load_page', content1Array[index], 'column1LYR');  
			ajaxManager('disArw', content2Array[index], 'column2LYR');	 
			ajaxManager('gld', scimageArray[index], 'glideDiv');
			ajaxManager('load_page3', left_imageArray[index], 'dropn');	   
			//document.cs_thumb2.src = ("images/cs_thumb2_3.png");
	  		//setTimeout('changeImg(2)', 650);
			//changeImg(2);
			changeImag(2);
			break;	
			case "SCthree":	
			index=2;  
			ajaxManager('load_page', content1Array[index], 'column1LYR');  
			ajaxManager('disArw', content2Array[index], 'column2LYR');	 
			ajaxManager('gld', scimageArray[index], 'glideDiv');
			ajaxManager('load_page3', left_imageArray[index], 'dropn');
			//document.cs_thumb3.write("<img src='images/cs_thumb3_3.png' border='0' />");
			//document.cs_thumb3.src = ("images/cs_thumb3_3.png");
    		changeImag(3);
			break;	
			case "SCfour":
			index=3; 
			ajaxManager('load_page', content1Array[index], 'column1LYR');  
			ajaxManager('disArw', content2Array[index], 'column2LYR');	 
			ajaxManager('gld', scimageArray[index], 'glideDiv');
			ajaxManager('load_page3', left_imageArray[index], 'dropn');	
			//document.cs_thumb4.src = ("images/cs_thumb4_3.png");
			changeImag(4);	 	
			break;	
			case "SCfive":
			index=4; 
			ajaxManager('load_page', content1Array[index], 'column1LYR');  
			ajaxManager('disArw', content2Array[index], 'column2LYR');	 
			ajaxManager('gld', scimageArray[index], 'glideDiv');
			ajaxManager('load_page3', left_imageArray[index], 'dropn');	
			//document.cs_thumb5.src = ("images/cs_thumb5_3.png");
			changeImag(5);	 	
			break;	
			case "SCsix":
			//document.cs_thumb6.src = ("images/cs_thumb6_3.png");
			index=5; 
			ajaxManager('load_page', content1Array[index], 'column1LYR');  
			ajaxManager('disArw', content2Array[index], 'column2LYR');	 
			ajaxManager('gld', scimageArray[index], 'glideDiv');
			ajaxManager('load_page3', left_imageArray[index], 'dropn');	 
			changeImag(6);		
			break;	
			case "SCsev": 
			//document.cs_thumb7.src = ("images/cs_thumb7_3.png");
			index=6; 
			ajaxManager('load_page', content1Array[index], 'column1LYR');  
			ajaxManager('disArw', content2Array[index], 'column2LYR');	 
			ajaxManager('gld', scimageArray[index], 'glideDiv');
			ajaxManager('load_page3', left_imageArray[index], 'dropn');	
			changeImag(7);	 	
			break;	
			case "SCeight":	
			//document.cs_thumb8.src = ("images/cs_thumb8_3.png");
			index=7; 
			ajaxManager('load_page', content1Array[index], 'column1LYR');  
			ajaxManager('disArw', content2Array[index], 'column2LYR');	 
			ajaxManager('gld', scimageArray[index], 'glideDiv');
			ajaxManager('load_page3', left_imageArray[index], 'dropn');	
			changeImag(8);	 	
			break;	 
			case "SCnine":	
			//document.cs_thumb8.src = ("images/cs_thumb8_3.png");
			index=8; 
			ajaxManager('load_page', content1Array[index], 'column1LYR');  
			ajaxManager('disArw', content2Array[index], 'column2LYR');	 
			ajaxManager('gld', scimageArray[index], 'glideDiv');
			ajaxManager('load_page3', left_imageArray[index], 'dropn');	
			changeImag(9);	 	
			break;
			case "cycle_gallery": 
			if (args[1] == 'rev' && index != content1Array.length - 1)
				{
				index++; 
				ajaxManager('load_page', content1Array[index], 'column1LYR');  
				ajaxManager('disArw', content2Array[index], 'column2LYR');	 
				ajaxManager('gld', scimageArray[index], 'glideDiv');
				ajaxManager('load_page3', left_imageArray[index], 'dropn');	
				} 
			else if (args[1] == 'rev' && index != content1Array.length)
			{  
			index=0; 
			ajaxManager('load_page', content1Array[index], 'column1LYR');  
			ajaxManager('disArw', content2Array[index], 'column2LYR');	 
			ajaxManager('gld', scimageArray[index], 'glideDiv');
			ajaxManager('load_page3', left_imageArray[index], 'dropn');	  
			}	
			else if (args[1] == 'forw' && index != 0) 
				{  
				index--; 
				ajaxManager('load_page', content1Array[index], 'column1LYR'); 
				ajaxManager('disArw', content2Array[index], 'column2LYR');  
				ajaxManager('sc_img', scimageArray[index], 'glideDiv');
				ajaxManager('load_page2', left_imageArray[index], 'dropn');
				}	
			else if (args[1] == 'forw' && index == 0)
			{  
			index=8; 
			ajaxManager('load_page', content1Array[index], 'column1LYR');  
			ajaxManager('disArw', content2Array[index], 'column2LYR');	 
			ajaxManager('sc_img', scimageArray[index], 'glideDiv');
			ajaxManager('load_page2', left_imageArray[index], 'dropn');
			
			} 
			break;
   
	  	case "start_up":
	  	ajaxManager('array_setup');	   
		ajaxManager('load_page', content1Array[index], 'column1LYR');
		ajaxManager('load_page1', content2Array[index], 'column2LYR');  
		ajaxManager('load_page1', left_imageArray[index], 'dropn');	
		ajaxManager('gld', scimageArray[index], 'glideDiv');
		break;
		}
	}  /*
function glideContent()	{
var timer1 = null;
var steps = 20;
var decrease = 0.09;
 if (document.getElementById)
  {
  endPos = document.body.offsetLeft;
  el = document.getElementById("contentLYR");
   }
 el.xpos = el.offsetLeft;
 if (el.xpos < endPos)
  {
  clearTimeout(timer1);
  }
 else if (el.xpos >= endPos)
  {
  clearTimeout(timer1);
  }
 distance = endPos - el.xpos + 5;
 steps = distance * decrease;
 el.xpos += steps;
 el.style.left = el.xpos + px;
 timer1 = setTimeout("glideContent()", 50);
}		
function glideContent2()	{
var timer2 = null;
var steps = 20;
var decrease = 0.09;
 if (document.getElementById)
  {
  endPos2 = document.body.offsetLeft;
  el = document.getElementById("contentLYR");
   }
 el.xpos2 = el.offsetLeft;
 if (el.xpos2 < endPos2)
  {
  clearTimeout(timer2);
  }
 else if (el.xpos2 >= endPos2)
  {
  clearTimeout(timer2);
  }
 distance = endPos2 - el.xpos2 + 5;
 steps = distance * decrease;
 el.xpos2 += steps;
 el.style.left = el.xpos2 + 10 + px;
 timer2 = setTimeout("glideContent()", 50);
}	 	 */
