

var totalSlide = 14;
var prevSlide = -1;
var nextSlide = 1;
var thisPic = 0;
var index = 0;
var ATVSlideId = 0;


// Will populate data based on input
function SlideshowCont(SlideIdAJAX)
{   
	//alert(SlideIdAJAX);
	Slideshow_Index_PhotoGallery(100)
	/*ATVSlideId = SlideIdAJAX;
	if (SlideIdAJAX.length==0)
	{      
		document.getElementById("SlideContent").innerHTML="";   
		return; 
	} 

	xmlHttp=GetXmlHttpObject() 
	if (xmlHttp==null)  
	{   
	  alert ("Browser does not support HTTP Request");   
	  return;   
	} 

	  url = "Index-Imagegallery.asp";
	  url = url+"?imgId=" + SlideIdAJAX;
	  url = url+"&sid="+Math.random();   
	 // alert(url);
	  xmlHttp.onreadystatechange=stateChanged;
	  xmlHttp.open("GET",url,true) ; 
	  xmlHttp.send(null);
	  */

  }



//BILL TO STATE
function GetXmlHttpObject(handler)
{   
	var objXMLHttp=null
	if (window.XMLHttpRequest) 
	{
		objXMLHttp=new XMLHttpRequest() 
	}   
	else if (window.ActiveXObject)  
	{
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")  
	}
	return objXMLHttp
}
	
function stateChanged()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")  
	{   
		document.getElementById("SlideContent").innerHTML= xmlHttp.responseText; 
		if(ATVSlideId == 9)
		{
			document.getElementById('showHideATV').innerHTML = mySlideATV[0];
		}
	} 
}


function Slideshow_PrevNext(ImageId) 
{

	//document.getElementById('srn').style.display = "inline";
	//document.getElementById('outer').style.display = "inline";
	if(screen.width > 1024)
	{
		document.getElementById('outer').style.left = (screen.width / 2)-390+"px";
		document.getElementById('outer').style.top = (screen.height / 2)-290+"px";
	}
	
	var SlideId = (eval(ImageId)-1);
	SlideshowCont(SlideId);
	//document.getElementById('SlideContent').innerHTML = mySlideShow[SlideId];
	
	thisPic = eval(ImageId)-1;
	nextSlide = eval(thisPic)+1;
   	prevSlide = eval(thisPic)-1;

	
	if(ImageId <= 1)
 	{
		document.getElementById("SlidePrev").style.display = "none";
	}
	else
	{
		document.getElementById("SlidePrev").style.display = "inline";
	}

	if(ImageId >= totalSlide)
 	{
		document.getElementById("SlideNext").style.display = "none";
	}
	else
	{
		document.getElementById("SlideNext").style.display = "inline";
	}
}

function doPrevious()
{
   	if(prevSlide > -1)
   	{
   		nextSlide = thisPic;
   	   	thisPic = prevSlide;
   	   	prevSlide--;

		SlideshowCont(parseInt(thisPic));
		if(parseInt(thisPic) == 8)
		{
			//document.getElementById('showHideATV').innerHTML = mySlideATV[0];
		}
	}
	else
	{
		prevSlide = -1;
		thisPic = 0;
		nextSlide = 1;
	}

	if(prevSlide <= -1)
 	{
		document.getElementById("SlidePrev").style.display = "none";
	}

	if(prevSlide <= totalSlide)
	{
		document.getElementById("SlideNext").style.display = "inline";
	}
}


function doNext()
{
  	if(nextSlide < totalSlide)
   	{
   	   prevSlide = thisPic;
   	   thisPic = nextSlide;
   	   nextSlide++;
   	   	
		SlideshowCont(parseInt(thisPic));
	}
	else
	{
		prevSlide = totalSlide-1;
		thisPic = totalSlide-1;
		nextSlide = totalSlide;
	}

	if(nextSlide >= 1)
	{
		document.getElementById("SlidePrev").style.display = "inline";
	}
	else
	{
		document.getElementById("SlidePrev").style.display = "none";
	}

	if(nextSlide >= totalSlide)
	{
		document.getElementById("SlideNext").style.display = "none";
	}
}

function SlideHide_PrevNext() 
{	
	document.getElementById('srn').style.display = "none";
	document.getElementById('outer').style.display = "none";
	document.getElementById("SlideContent").innerHTML="";   
}

function Slideshow_PhotoGallery(GalleryId) 
{
	//document.getElementById('srnPhoto').style.display = "inline";
	//document.getElementById('photoMain').style.display = "inline";
//	if(screen.width > 1024)
//	{
//		document.getElementById('photoMain').style.left = (screen.width / 2)-320+"px";
//		document.getElementById('photoMain').style.top = (screen.height / 2)-390+"px";
//	}

	//initSlideShow(GalleryId);
	if(GalleryId == 1)
	{
		$('#Gallery1').mbGallery({color:'#000',maskBgnd:'#ccc', overlayOpacity:.9,startFrom: 0});
	}
	else if(GalleryId == 2)
	{
		$('#Gallery2').mbGallery({maskBgnd:'#ccc', overlayOpacity:.9,startFrom: 0});
	}
	else if(GalleryId == 3)
	{
		$('#Gallery3').mbGallery({maskBgnd:'#ccc', overlayOpacity:.9,startFrom: 0});
	}
	else if(GalleryId == 4)
	{
		$('#Gallery4').mbGallery({maskBgnd:'#ccc', overlayOpacity:.9,startFrom: 0});
	}
	else if(GalleryId == 5)
	{
		$('#Gallery5').mbGallery({maskBgnd:'#ccc', overlayOpacity:.9,startFrom: 0});
	}
	else if(GalleryId == 6)
	{
		$('#Gallery6').mbGallery({maskBgnd:'#ccc', overlayOpacity:.9,startFrom: 0});
	}
	else if(GalleryId == 7)
	{
		$('#Gallery7').mbGallery({maskBgnd:'#ccc', overlayOpacity:.9,startFrom: 0});
	}
	else if(GalleryId == 8)
	{
		$('#Gallery8').mbGallery({maskBgnd:'#ccc', overlayOpacity:.9,startFrom: 0});
	}
	else if(GalleryId == 9)
	{
		$('#Gallery9').mbGallery({maskBgnd:'#ccc', overlayOpacity:.9,startFrom: 0});
	}
	else if(GalleryId == 10)
	{
		$('#Gallery10').mbGallery({maskBgnd:'#ccc', overlayOpacity:.9,startFrom: 0});
	}
	else if(GalleryId == 11)
	{
		$('#Gallery11').mbGallery({color:'#000',maskBgnd:'#ccc', overlayOpacity:.9,startFrom: 0});
	}
	else if(GalleryId == 12)
	{
		$('#Gallery12').mbGallery({maskBgnd:'#ccc', overlayOpacity:.9,startFrom: 0});
	}
	else if(GalleryId == 13)
	{
		$('#Gallery13').mbGallery({maskBgnd:'#ccc', overlayOpacity:.9,startFrom: 0});
	}
	else if(GalleryId == 14)
	{
		$('#Gallery14').mbGallery({maskBgnd:'#ccc', overlayOpacity:.9,startFrom: 0});
	}
	else if(GalleryId == 15)
	{
		$('#Gallery15').mbGallery({maskBgnd:'#ccc', overlayOpacity:.9,startFrom: 0});
	}
}

function Slideshow_Index_PhotoGallery(GalleryId) 
{
	//document.getElementById('srnPhoto').style.display = "inline";
	//document.getElementById('photoMain').style.display = "inline";
//	if(screen.width > 1024)
//	{
//		document.getElementById('photoMain').style.left = (screen.width / 2)-320+"px";
//		document.getElementById('photoMain').style.top = (screen.height / 2)-390+"px";
//	}
//alert(GalleryId);
	//initSlideShow(GalleryId);
	if(GalleryId == 100)
	{
		$('#Gallery100').mbGallery({maskBgnd:'#ccc', overlayOpacity:.9,startFrom: 0});
	}
	else if(GalleryId == 2)
	{
		$('#Gallery2').mbGallery({maskBgnd:'#ccc', overlayOpacity:.9,startFrom: 0});
	}
	else if(GalleryId == 3)
	{
		$('#Gallery3').mbGallery({maskBgnd:'#ccc', overlayOpacity:.9,startFrom: 0});
	}
	else if(GalleryId == 4)
	{
		$('#Gallery4').mbGallery({maskBgnd:'#ccc', overlayOpacity:.9,startFrom: 0});
	}
	else if(GalleryId == 5)
	{
		$('#Gallery5').mbGallery({maskBgnd:'#ccc', overlayOpacity:.9,startFrom: 0});
	}
	else if(GalleryId == 6)
	{
		$('#Gallery6').mbGallery({maskBgnd:'#ccc', overlayOpacity:.9,startFrom: 0});
	}
	else if(GalleryId == 7)
	{
		$('#Gallery7').mbGallery({maskBgnd:'#ccc', overlayOpacity:.9,startFrom: 0});
	}
	else if(GalleryId == 8)
	{
		$('#Gallery8').mbGallery({maskBgnd:'#ccc', overlayOpacity:.9,startFrom: 0});
	}
	else if(GalleryId == 9)
	{
		$('#Gallery9').mbGallery({maskBgnd:'#ccc', overlayOpacity:.9,startFrom: 0});
	}
	else if(GalleryId == 10)
	{
		$('#Gallery10').mbGallery({maskBgnd:'#ccc', overlayOpacity:.9,startFrom: 0});
	}
	else if(GalleryId == 11)
	{
		$('#Gallery11').mbGallery({maskBgnd:'#ccc', overlayOpacity:.9,startFrom: 0});
	}
	else if(GalleryId == 12)
	{
		$('#Gallery12').mbGallery({maskBgnd:'#ccc', overlayOpacity:.9,startFrom: 0});
	}
	else if(GalleryId == 13)
	{
		$('#Gallery13').mbGallery({maskBgnd:'#ccc', overlayOpacity:.9,startFrom: 0});
	}
	else if(GalleryId == 14)
	{
		$('#Gallery14').mbGallery({maskBgnd:'#ccc', overlayOpacity:.9,startFrom: 0});
	}
	else if(GalleryId == 15)
	{
		$('#Gallery15').mbGallery({maskBgnd:'#ccc', overlayOpacity:.9,startFrom: 0});
	}
}

function hidePhotoGallery() 
{
	document.getElementById('srnPhoto').style.display = "none";
	document.getElementById('photoMain').style.display = "none";
}

function ShowHide_ATV(SlideVal)
{
	if(SlideVal != "")
	{
		document.getElementById('showHideATV').innerHTML = mySlideATV[SlideVal];
	}
}

var mySlideATV = new Array();

mySlideATV[0] = '<div class="p-mr-main"><div class="hd-dk-mrn">Mad Riders ATV</div><div class="p-m-row"><div class="p-mr-left"><div class="safty-icon"><img src="images/safty.png" width="84" height="83" onload="fixPNG(this)" /></div><div class="p-mr-lhd">Learn More About:</div><div class="p-mr-link"><a href="pdf/atv_c.pdf" target="_blank">Correct Way to Ride</a><br /> <a href="pdf/atv_s.pdf" target="_blank">Safety Instructions</a><br /> <a href="pdf/atv_reg_cum_consent_form.pdf" target="_blank">Registration & <br />Consent Form</a><br /> <a href="pdf/terms_conditions.pdf" target="_blank">Terms and Conditions</a></div> <div class="pic-icon" title="View Photos" onclick="Slideshow_Index_PhotoGallery(11)"></div></div><div class="p-mr-rig" align="right"><div class="p-mr-con">Catch the ATV fever! Ride the awesome 50 cc to 150 cc All Terrain Vehicles at The Wild Tribe Ranch. On a track that will surely challenge you...<br /> <br /> We have some of these powerful beasties<br /> <strong>- get on one and conquer the track!<br /> Get off-road... go wild!</strong><br /> <br /> <strong>Coming shortly </strong>- 250cc and 350 cc ATVs. Watch out!<br /> <br /> <strong>For the beginner:</strong> We have specially trained Wild Tribe Guides to show you the basics - and equip you for a safe and enjoyable ride. While on safety, Wild Tribe\'s commitment to safety and regulations is stringent and we request you to follow the rules for you and your family\'s safety..<br /> <br /> <strong>Please click</strong> the safety symbol to learn all about Wild Tribe safety norms, rules and terms.<br /> <br /> <strong>For the skilled ATV champs:</strong> Watch out for a spine-chilling light\'s off Night Riders! A challenge you will not be able to resist. You can also register for special ATV off-roader safaris.</div><div class="p-mr-con-2"><span style="cursor:hand; cursor:pointer;" class="linkable-bold" onclick="return ShowHide_ATV(\'1\')">Mad Riders Kids ATV</span></div></div></div></div>'

mySlideATV[1] = '<div class="p-mr-main"><div class="hd-dk-mrn">Mad Riders Kids ATV</div><div class="p-m-row"><div class="p-mr-left"><div class="safty-icon"><img src="images/safty.png" width="84" height="83" onload="fixPNG(this)" /></div><div class="p-mr-lhd">Learn More About:</div><div class="p-mr-link"><a href="pdf/atv_c.pdf" target="_blank">Correct Way to Ride</a><br /> <a href="pdf/atv_s.pdf" target="_blank">Safety Instructions</a><br /> <a href="pdf/atv_reg_cum_consent_form.pdf" target="_blank">Registration & <br />Consent Form</a><br /> <a href="pdf/terms_conditions.pdf" target="_blank">Terms and Conditions</a></div> <div class="pic-icon" title="View Photos" onclick="Slideshow_Index_PhotoGallery(11)"></div></div><div class="p-mr-rig" align="right"><div class="p-mr-con"><div><table width="282" border="0" cellpadding="0" cellspacing="0"><tr><td width="306" align="left" valign="top"><img src="images/red-box-t.gif" width="282" height="8" /></td></tr><tr><td align="center" valign="top" bgcolor="#6F2528"><table width="94%" border="0" cellspacing="0" cellpadding="0"><tr><td height="18" colspan="2" align="left" valign="bottom" class="Arial-12-bold-white">Statutory warning:</td></tr><tr><td colspan="2" align="left">&nbsp;</td></tr><tr><td width="5%" align="left" valign="top"><img src="images/wh-bullet.gif" width="6" height="10" /></td><td width="95%" align="left" class="Arial-12-white">Our ATVs are extremely addictive</td></tr><tr><td colspan="2" align="left" valign="top"><img src="images/spacer.gif" width="1" height="5" /></td></tr><tr><td align="left" valign="top"><img src="images/wh-bullet.gif" width="6" height="10" /></td><td align="left" class="Arial-12-white">This addiction may also develop into a \'bad habit\'</td></tr><tr><td colspan="2" align="left" valign="top"><img src="images/spacer.gif" width="1" height="5" /></td></tr><tr><td align="left" valign="top"><img src="images/wh-bullet.gif" width="6" height="10" /></td><td align="left" class="Arial-12-white">This bad habit is extremely infectious</td></tr><tr><td colspan="2" align="left" valign="top"><img src="images/spacer.gif" width="1" height="5" /></td></tr><tr><td align="left" valign="top"><img src="images/wh-bullet.gif" width="6" height="10" /></td><td align="left" class="Arial-12-white">You may spread the infection to all your friends</td></tr><tr><td colspan="2" align="left" valign="top"><img src="images/spacer.gif" width="1" height="5" /></td></tr><tr><td align="left" valign="top"><img src="images/wh-bullet.gif" width="6" height="10" /></td><td align="left" class="Arial-12-white">It may lead to you and your friends spending a whole lot of time at Wild Tribe</td></tr><tr><td colspan="2" align="left" valign="top"><img src="images/spacer.gif" width="1" height="5" /></td></tr><tr><td align="left" valign="top"><img src="images/wh-bullet.gif" width="6" height="10" /></td><td align="left" class="Arial-12-white">Considering the danger and risk involved parent permission mandatory to try this addiction!</td></tr><tr><td colspan="2" align="left" valign="top"><img src="images/spacer.gif" width="1" height="10" /></td></tr></table></td></tr><tr><td align="left" valign="top"><img src="images/red-box-b.gif" width="282" height="8" /></td></tr><tr><td align="left" valign="top"><img src="images/spacer.gif" width="1" height="10" /></td></tr></table></div><strong>Come, ride, go wild!</strong> Remember, safety first, fun next!<br />So just follow your Wild Tribe Guide\'s instructions. Be cautious of<br />the other riders who may be younger than you or less skilled.</div><div class="p-mr-con-2"><span style="cursor:hand; cursor:pointer;" class="linkable-bold" onclick="return ShowHide_ATV(\'0\')">Mad Riders ATV</span></div></div></div></div>'


// Will populate data based on input
function SlideshowPopUp(PopUpId)
{   
	if (PopUpId.length==0)
	{      
		document.getElementById("SlideContent").innerHTML="";   
		return; 
	} 

	xmlHttp=GetXmlHttpObject() 
	if (xmlHttp==null)  
	{   
	  alert ("Browser does not support HTTP Request");   
	  return;   
	} 

	  url = "popupgallery.asp";
	  url = url+"?SlideId=" + PopUpId;
	  url = url+"&sid="+Math.random();   
	 // alert(url);
	  xmlHttp.onreadystatechange=stateChanged1;
	  xmlHttp.open("GET",url,true) ; 
	  xmlHttp.send(null);

  }

function stateChanged1()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")  
	{   
		
		document.getElementById('srnPopup').style.display = "inline";
		document.getElementById('ViewPopUp').style.display = "inline";
		if(screen.width > 1024)
		{
			document.getElementById('ViewPopUp').style.left = (screen.width / 2)-320+"px";
			document.getElementById('ViewPopUp').style.top = (screen.height / 2)-390+"px";
		}

		document.getElementById("ShowPopUp").innerHTML= xmlHttp.responseText; 
	} 
}

function getMovie(movieName){
	if (navigator.appName.indexOf("Microsoft") != -1) {
			//alert(window[movieName])
             return window[movieName];
         } else {
             return document[movieName];
         }
}

function hidePopUpGallery() 
{
	document.getElementById('srnPopup').style.display = "none";
	document.getElementById('ViewPopUp').style.display = "none";
	unMute();

	getMovie('playerid').stopVideo();
	getMovie('playerid').clearVideo();
	


}
var space = /^[\ ]*$/;
var validEmail=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9])+$/;
var validalpha = /^[a-zA-Z\'\.\ ]+$/;
var validphone = /^[0-9\+\-]+$/;

function validateForm(Form)
{
	if(space.test(Form.txtName.value))
	 {
		 alert("Please enter your name!");
		 Form.txtName.focus();
		 return false;
	 }
	 if(!validalpha.test(Form.txtName.value))
	 {
		 alert("Please enter your name properly!");
		 Form.txtName.focus();
		 Form.txtName.select();
		 return false;
	 }
	 
	 if(space.test(Form.txtEmail.value))
	 {
		 alert("Please enter an email address");
		 Form.txtEmail.focus();
		 return false;
	 }
	 if(!validEmail.test(Form.txtEmail.value))
	 {
		 alert("Please enter a valid email address");
		  Form.txtEmail.focus();
		 Form.txtEmail.select();
		 return false;
	 }
	 
	 if(space.test(Form.txtPhone.value))
	 {
		 alert("Please enter your phone number");
		 Form.txtPhone.focus();
		 return false;
	 }
	 if(!validphone.test(Form.txtPhone.value))
	 {
		 alert("Please enter valid phone number");
		 Form.txtPhone.focus();
		 Form.txtPhone.select();
		 return false;
	 }
	 if(space.test(Form.txtQuery.value))
	 {
		 alert("Please enter a message");
		 Form.txtQuery.focus();
		 return false;
	 }
	 Form.submit();
}

function doReset(Form)
{
	Form.reset();
}

function openNewWindow()
{
	window.open("pdf/totem_chroma_paint_ball.pdf");
}