aniFade='';
x=0;
y=0;
aniExpand='';
w=0;
h=0;
aniShrink='';
varscrollTo='';
aniScroll='';
aniGrow='';
scrollLock=1;

//-- BROCHURE RESET --//
function fnReset(){
 scrollLock=1;
 document.getElementById('idPoint11').style.display='none';

 document.getElementById('idFirstTab').style.display='block';
 document.getElementById('idSecondTab').style.display='block'; 
 
 document.getElementById('idTab0').style.display='block'; 
 document.getElementById('idPoint0_x').style.width='288px';
 document.getElementById('idPoint0_shadow').style.display='block';
 document.getElementById('idPoint0_shadow').scrollLeft=0;    

 document.getElementById('idPoint1').style.width='288px';
 document.getElementById('idPoint1_x').style.width='0px';
 
 document.getElementById('idPoint2').style.width='288px';
 document.getElementById('idPoint2').style.backgroundPosition='0px 0px';
 document.getElementById('idTab2').style.display='block';
 document.getElementById('idPoint2_x').style.width='288px';
 document.getElementById('idPoint2_xb').style.width='288px'; 
 document.getElementById('idPoint2_xb').style.display='block'; 
 document.getElementById('idPoint2_shadow').style.display='block';
 document.getElementById('idPoint2_shadow').backgroundPosition='0px 0px';   
  
 document.getElementById('idPoint4').style.width='288px';
 document.getElementById('idPoint4').style.backgroundPosition='0px 0px';
 document.getElementById('idTab4').style.display='block';  
 document.getElementById('idPoint4_x').style.width='0px';
 document.getElementById('idPoint4_xb').style.width='288px'; 
 document.getElementById('idPoint4_xb').style.display='none'; 
 document.getElementById('idPoint4_shadow').style.display='block'; 
 document.getElementById('idPoint4_shadow').backgroundPosition='0px 0px'; 
 
 document.getElementById('idPoint6').style.width='288px';
 document.getElementById('idPoint6').style.backgroundPosition='0px 0px'; 
 document.getElementById('idTab6').style.display='block';
 document.getElementById('idPoint6_x').style.width='0px';
 document.getElementById('idPoint6_xb').style.width='288px';  
 document.getElementById('idPoint6_xb').style.display='none';
 document.getElementById('idPoint6_shadow').style.display='block'; 
 document.getElementById('idPoint6_shadow').backgroundPosition='0px 0px'; 
 
 document.getElementById('idPoint8').style.width='288px'; 
 document.getElementById('idPoint8').style.backgroundPosition='0px 0px';
 document.getElementById('idTab8').style.display='block';
 document.getElementById('idPoint8_x').style.width='0px';
 document.getElementById('idPoint8_xb').style.width='288px';
 document.getElementById('idPoint8_xb').style.display='none';  
 document.getElementById('idPoint8_shadow').style.display='block';  
 document.getElementById('idPoint8_shadow').backgroundPosition='0px 0px';  

 document.getElementById('idPoint10').style.width='288px'; 
 document.getElementById('idPoint10').style.backgroundPosition='0px 0px';
 document.getElementById('idTab10').style.display='block';
 document.getElementById('idPoint10_x').style.width='0px';
 document.getElementById('idPoint10_xb').style.width='288px';
 document.getElementById('idPoint10_xb').style.display='none';  
 document.getElementById('idPoint10_shadow').style.display='block';  
 document.getElementById('idPoint10_shadow').backgroundPosition='0px 0px';
 
 document.getElementById('idBrochure').style.width='288px';
 document.getElementById('idBrochure').scrollLeft=288;
}

function fnReset2(){
 document.getElementById('idPoint11').innerHTML='<img onload="fnReset3();" style="display:none" src="images/brochures/point11.jpg"/>'; 
}

function fnReset3(){
 document.getElementById('idPoint11').style.display='block';

 document.getElementById('idPoint11').style.width='288px';
 document.getElementById('idPoint11').style.backgroundPosition='0px 0px';

 document.getElementById('idBrochure').style.width='288px';
 document.getElementById('idBrochure').scrollLeft=0;
}

function fnRollOutTab(tmpId){
 document.getElementById(tmpId).src="images/brochures/blank_tab.png";
}

function fnRollInTab(tmpId,tmpSide){
 switch(tmpSide){
  case 1 :  document.getElementById(tmpId).src="images/brochures/up_tab_right.png";
	 break;	
	case 2 :  document.getElementById(tmpId).src="images/brochures/up_tab_left.png";
	 break;
 }
}

//-- OPEN LEFT TAB FOR BROCHURES --//
function fnOpenLeft(tmpId,tmpId2){
 fnShrinkTab(tmpId,tmpId2);
}

function fnShrinkTab(tmpId,tmpId2){

 if(document.getElementById(tmpId+'_xb').style.display=="none"){
	document.getElementById(tmpId+'_xb').style.display="block";
	document.getElementById(tmpId+'_x').style.display="none";
 } 

 clearTimeout(aniShrink);
 tmpWidth=parseFloat(document.getElementById(tmpId+'_xb').style.width.replace(/px/,""));
 
 switch(tmpWidth){
  case 198 : document.getElementById(tmpId+'_shadow').style.backgroundPosition="-288px 0px";
	 break;
  case 168 : document.getElementById(tmpId+'_shadow').style.backgroundPosition="-576px 0px";
	 break;
  case 138 : document.getElementById(tmpId+'_shadow').style.backgroundPosition="-864px 0px";
	 break;
  case 98 : document.getElementById(tmpId+'_shadow').style.backgroundPosition="-1152px 0px";
	 break;
  case 68 : document.getElementById(tmpId+'_shadow').style.backgroundPosition="-1152px 0px";
	 break;	
  case 38 : document.getElementById(tmpId+'_shadow').style.backgroundPosition="-1440px 0px";
	 break;	  
 } 
 
 if(tmpId2){
  document.getElementById('idTab'+tmpId2).style.display="none";
 } 
 
 if(tmpWidth>120){
	tmpWidth=tmpWidth-10;
  document.getElementById(tmpId+'_xb').style.width=tmpWidth+"px";

	if(scrollLock==1){
	 document.getElementById('idBrochure').scrollLeft=scrollLock;
	}

  aniShrink=setTimeout('fnShrinkTab(\''+tmpId+'\','+tmpId2+');', 15); //10

 } else if(tmpWidth>20){
	tmpWidth=tmpWidth-20;
  document.getElementById(tmpId+'_xb').style.width=tmpWidth+"px";
  aniShrink=setTimeout('fnShrinkTab(\''+tmpId+'\','+tmpId2+');', 15); //10

 } else {
  document.getElementById(tmpId+'_shadow').style.display="none";	
  document.getElementById(tmpId+'_xb').style.width="0px";

  tmpWidth=parseFloat(document.getElementById(tmpId).style.width.replace(/px/,""));	
	
	tmpStr=''+ tmpId +'';
	tmpStr=tmpStr.replace(/idPoint/,"");
	tmpStr=parseFloat(tmpStr);
	tmpStr=tmpStr+2;

  scrollLock=0;
	fnScrollBrochure2(tmpWidth,'idPoint'+tmpStr);	
 }

}
//-- OPEN LEFT TAB FOR BROCHURES END --//

//-- OPEN RIGHT TAB FOR BROCHURES --//
function fnOpenRight(tmpId){
 fnShrinkTabRight(tmpId);
}

function fnGrowBrochureWindow(){
 clearTimeout(aniGrow);
 tmpBWidth=parseFloat(document.getElementById('idBrochure').style.width.replace(/px/,""));
 
 if(tmpBWidth<520){
  tmpBWidth=tmpBWidth+30;
  document.getElementById('idBrochure').style.width=tmpBWidth+"px";
  aniGrow=setTimeout('fnGrowBrochureWindow();', 0);	
 } else {
  document.getElementById('idBrochure').style.width="535px";
 }
}

function fnGrowBrochureWindow2(tmpId){
 clearTimeout(aniGrow);
 tmpBWidth=parseFloat(document.getElementById('idBrochure').style.width.replace(/px/,""));
 
 if(tmpBWidth<400){
  tmpBWidth=tmpBWidth+30;
  document.getElementById('idBrochure').style.width=tmpBWidth+"px";

	tmpNewScroll=parseFloat(document.getElementById('idBrochure').scrollLeft);
	document.getElementById('idBrochure').scrollLeft=tmpNewScroll-30;
	
	//-- PAGE STRETCH --//
	tmpNewWidth=parseFloat(document.getElementById(tmpId+'_x').style.width.replace(/px/, ""));
	tmpNewWidth=tmpNewWidth+12;
  document.getElementById(tmpId+'_x').style.width=tmpNewWidth+"px";

	document.getElementById(tmpId+'_x').style.backgroundPosition="0px 0px";
	//-- PAGE STRETCH END --//			
	
  aniGrow=setTimeout('fnGrowBrochureWindow2(\''+ tmpId +'\');', 10);	
 } else if(tmpBWidth<576){
 // alert('is less than 450');
  tmpBWidth=tmpBWidth+12;
  document.getElementById('idBrochure').style.width=tmpBWidth+"px";

	tmpNewScroll=parseFloat(document.getElementById('idBrochure').scrollLeft);
	document.getElementById('idBrochure').scrollLeft=tmpNewScroll-12;

	//-- PAGE STRETCH --//	
	tmpNewWidth=parseFloat(document.getElementById(tmpId+'_x').style.width.replace(/px/,""));
	tmpNewWidth=tmpNewWidth+12;
  document.getElementById(tmpId+'_x').style.width=tmpNewWidth+"px";

	document.getElementById(tmpId+'_x').style.backgroundPosition="0px 0px";
	//-- PAGE STRETCH END --//	
	
  aniGrow=setTimeout('fnGrowBrochureWindow2(\''+ tmpId +'\');', 10);	
 } else {
	//-- PAGE STRETCH --//
  document.getElementById(tmpId+'_x').style.width="288px";	
  document.getElementById(tmpId+'_x').style.backgroundPosition="0px 0px";	
	//-- PAGE STRETCH END --//
	
  document.getElementById('idBrochure').style.width="576px";
  document.getElementById('idBrochure').scrollLeft="0px";
	
  document.getElementById('idFirstTab').style.display="none";
  document.getElementById('idSecondTab').style.display="block";	
 }
 
}

function fnShrinkTabRight(tmpId){
 
 clearTimeout(aniShrink);
 tmpWidth=parseFloat(document.getElementById(tmpId+'_x').style.width.replace(/px/,""));

 switch(tmpWidth){
  case 198 : document.getElementById(tmpId+'_shadow').style.backgroundPosition="0px 0px";
	 break;
  case 168 : document.getElementById(tmpId+'_shadow').style.backgroundPosition="-288px 0px";
	 break;
  case 138 : document.getElementById(tmpId+'_shadow').style.backgroundPosition="-576px 0px";
	 break;
  case 98 : document.getElementById(tmpId+'_shadow').style.backgroundPosition="-864px 0px";
	 break;
  case 68 : document.getElementById(tmpId+'_shadow').style.backgroundPosition="-1152px 0px";
	 break;	
  case 38 : document.getElementById(tmpId+'_shadow').style.backgroundPosition="-1440px 0px";
	 break;	  
 }
 
 if(tmpWidth>120){
	tmpWidth=tmpWidth-10;
  document.getElementById(tmpId+'_x').style.width=tmpWidth+"px";
  aniShrink=setTimeout('fnShrinkTabRight(\''+tmpId+'\');', 15); //10

 } else if(tmpWidth>20){
	tmpWidth=tmpWidth-20;
  document.getElementById(tmpId+'_x').style.width=tmpWidth+"px";
  aniShrink=setTimeout('fnShrinkTabRight(\''+tmpId+'\');', 15); //10

 } else {
  document.getElementById(tmpId+'_shadow').style.display="none";	
  document.getElementById(tmpId+'_x').style.width="0px";

	tmpStr=''+ tmpId +'';
	tmpStr=tmpStr.replace(/idPoint/,"");
	tmpStr=parseFloat(tmpStr);
	tmpStr=tmpStr+1;
	
	fnGrowBrochureWindow2('idPoint'+tmpStr);
 }

}
//-- OPEN RIGHT TAB FOR BROCHURES END --//

//-- SCROLL FOR BROCHURE --//
function fnScrollBrochure2(tmpScrollAmount,tmpId){

 if(document.getElementById(tmpId+'_x').style.display=="none"){
	document.getElementById(tmpId+'_x').style.display="block";
	document.getElementById(tmpId+'_xb').style.display="none";
 }
 
 clearTimeout(aniScroll);
 tmpNewScroll=parseFloat(document.getElementById('idBrochure').scrollLeft);
 
 if(varscrollTo==''){

  varscrollTo=tmpNewScroll+tmpScrollAmount; //set scroll to value
	
  aniShrink=setTimeout('fnScrollBrochure2('+tmpScrollAmount+',\''+ tmpId +'\');', 15);	
 } else {

  //alert('scrolling');
 
  if(tmpNewScroll<varscrollTo){
   document.getElementById('idBrochure').scrollLeft=tmpNewScroll+12;
	 
	 
	//-- PAGE STRETCH --//
	tmpNewWidth=parseFloat(document.getElementById(tmpId+'_x').style.width.replace(/px/, ""));
	if(tmpNewWidth<288){
	 tmpNewWidth=tmpNewWidth+12;
	}
  document.getElementById(tmpId+'_x').style.width=tmpNewWidth+"px";

	//-- PAGE STRETCH END --//	 
	
  aniShrink=setTimeout('fnScrollBrochure2('+tmpScrollAmount+',\''+ tmpId +'\');', 15);	

	} else {

	varscrollTo='';
	 
	//-- PAGE STRETCH --//
  document.getElementById(tmpId+'_x').style.width="288px";	
  document.getElementById(tmpId+'_x').style.backgroundPosition="0px 0px";	
	//-- PAGE STRETCH END --//	 
		 
	 clearTimeout(aniScroll);
	}

 }
 
}
//-- SCROLL FOR BROCHURE EMD --//

//-- SCROLL FOR BROCHURE --//
function fnScrollBrochure(tmpScrollAmount){
 clearTimeout(aniScroll);
 tmpNewScroll=parseFloat(document.getElementById('idBrochure').scrollLeft);

 
 if(varscrollTo==''){
  //alert('setting up');
  varscrollTo=tmpNewScroll+tmpScrollAmount; //set scroll to value
	document.getElementById('idBrochure').scrollLeft=tmpNewScroll+10;
  aniShrink=setTimeout('fnScrollBrochure('+tmpScrollAmount+');', 0);	
 } else {

  //alert('scrolling');
 
  if(tmpNewScroll<varscrollTo){
   document.getElementById('idBrochure').scrollLeft=tmpNewScroll+10;
   aniShrink=setTimeout('fnScrollBrochure('+tmpScrollAmount+');', 0);
	} else {
	 varscrollTo='';
	 clearTimeout(aniScroll);
	}

 }
 
}
//-- SCROLL FOR BROCHURE EMD --//

//- FADE OUT --//
function animateFadeOut(tmpPage,tmpExpand){
 clearTimeout(aniFade);

 if(x>-3966){ //500
  x=x-162; //20
 }

  var arr = document.getElementsByTagName('div');
  for(i=0;i<arr.length;i++) {
   if(arr[i].getAttribute("name")=="fade"){
    arr[i].style.backgroundPosition=x+"px "+y+"px";  
   }
  }
 
 if(x>-3966){ 
  aniFade=setTimeout('animateFadeOut(\''+tmpPage+'\',\''+tmpExpand+'\');', 0);
 } else {
  //ADDED FOR FASTER FADES...
	document.getElementById('left_content_wrap').style.display="none"; 
  //alert('check');
  ajaxDisplay(tmpPage,tmpExpand);
 }
}
//-- FADE OUT END --//


//-- FADE IN --//
function animateFadeIn(tmpPage,tmpExpand){
 clearTimeout(aniFade);

 if(x<0){
  x=x+162; //20
 }

  var arr = document.getElementsByTagName('div');
  for(i=0;i<arr.length;i++) {
   if(arr[i].getAttribute("name")=="fade"){
    arr[i].style.backgroundPosition=x+"px "+y+"px";  
   }
  }
 
 if(x<0){ 
  aniFade=setTimeout('animateFadeIn(\''+tmpPage+'\',\''+tmpExpand+'\');', 0);
 } else {
  document.getElementById('left_content_wrap').style.zIndex=100;
  document.getElementById('idFade').style.zIndex=99;

	/* for tab selected state */
  document.getElementById('recent').src="images/recent.png";
  document.getElementById('print').src="images/print.png";
  document.getElementById('identity').src="images/identity.png";
  document.getElementById('web').src="images/web.png";	
	//alert('here');
	if(
	   (tmpPage=='recent') ||
	   (tmpPage=='print') ||
	   (tmpPage=='identity') ||
	   (tmpPage=='web')		 		 		 
		){
   document.getElementById(tmpPage).src="images/r_"+tmpPage+".png";
	}

 }
}
//-- FADE IN END --//


//-- EXPAND --//
function animateExpand(){

 clearTimeout(aniExpand);

 if(w<580){
  w=w+40; //20
 }
 
 if(h<640){ //650
  h=h+20; //10
 } 

 document.getElementById('left_content_wrap').style.width=w+"px";
 document.getElementById('left_content_wrap').style.height=h+"px";
 
 if(
   (w<580)||
   (h<650)
	 ){
  aniExpand=setTimeout('animateExpand();', 0);
 }
}
//-- EXPAND END --//


function fnBeginDisplay(tmpPage,tmpExpand){

 //alert('here');

 /* FADE OUT */
 document.getElementById('left_content_wrap').style.zIndex=99;
 document.getElementById('idFade').style.zIndex=100;
 x=0;
 animateFadeOut(tmpPage,tmpExpand); 
}

//-- AJAX FOR DISPLAY --//
function ajaxDisplay(tmpPage,tmpExpand)
{
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;
      }
    }
  }
  xmlHttp.onreadystatechange=function()
    {
    if(xmlHttp.readyState==4)
      {

       //ADDED FOR FASTER FADES...
       document.getElementById('left_content_wrap').style.display="block";			
			
			 //alert(xmlHttp.responseText);
			 if(tmpExpand=='go'){
			  document.getElementById('left_content_wrap').style.width="0px";
			  document.getElementById('left_content_wrap').style.height="0px";
				w=0;
				h=0;
				document.getElementById('left_content_wrap').innerHTML=xmlHttp.responseText;
			  /* FADE BACK IN */
        animateFadeIn(tmpPage,tmpExpand);
				
				/* EXPAND */
				animateExpand(tmpPage,tmpExpand);				
			 } else {
			  document.getElementById('left_content_wrap').innerHTML=xmlHttp.responseText;
			  /* FADE BACK IN */
			 }
			 			 
      }
    }
	xmlHttp.open("GET","xml/xml_"+ tmpPage +".php",true);
	
  xmlHttp.send(null);
  }
//-- AJAX FOR DISPLAY --//


 function fnRollIn(button){
  document.getElementById(button).src="http://www.graphic-fx.com/images/r_"+ button +".png";
 }

 function fnRollOut(button,file){
   document.getElementById(button).src="http://www.graphic-fx.com/images/"+ button +".png";	
 }
 
/* 
 function fnPreLoad(){
 
  //Selected
  Image1b = new Image(4212,145);
  Image1b.src = "images/fadesB.png";

 }
 
window.onload=function(){
 fnPreLoad();
 var arr = document.getElementsByTagName('div');
 for(i=0;i<arr.length;i++) {
  if(arr[i].getAttribute("name")=="fade"){
   arr[i].style.backgroundImage=Image1b.src;  
  }
 }
} 
*/

/* 
window.onload=function(){
(function(a,b){if(/android|avantgo|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|e\-|e\/|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(di|rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|xda(\-|2|g)|yas\-|your|zeto|zte\-/i.test(a.substr(0,4)))window.location=b})(navigator.userAgent||navigator.vendor||window.opera,'http://graphic-fx.com/mobile.html');
} 
*/
