//	Ajax gloabl variavle
var XMLobj=createXMLObject();
var XMLobj1=createXMLObject();
var XMLobj2=createXMLObject();

var params1='';
var params2='';
var params3='';
var type;
var subMenuId;

var type1;
var subMenuId1;

var type2;
var subMenuId2;

function createXMLObject()
{
	try{
		//	If browser is not IE. If Firefox ,etc
		return  new XMLHttpRequest();
	}
	catch(e){
		try{
			//	If browser is old IE
			return new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(e2){
			try{
				//	If browser is IE version >6
				return new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch(e3){
				//	if browser does not support then show alert
				alert("Your broswer does not support ActiveXObjects.");
				return false;
			}
		}
	}
}

//	function to get the page content 
function get_data(type,subMenuId)
{
	params1="type="+type+"&subMenuId="+subMenuId;
	
	posting();
}

function get_news_drink(type1,subMenuId1)
{
	params2="type="+type1+"&subMenuId="+subMenuId1;

	post_news_drink();
}

function get_news_bar(type2,subMenuId2)
{
	params3="type="+type2+"&subMenuId="+subMenuId2;

	post_news_bar();
}

//	function to get the page content
function posting()
{
	if(XMLobj2.readyState==0 || XMLobj2.readyState==4)
	{
		XMLobj2.open("POST", "../../_site/php/dataResults.php", true );
		XMLobj2.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); 
		XMLobj2.onreadystatechange=showing;
		XMLobj2.send(params1);
	}
}

function post_news_drink()
{
	if(XMLobj.readyState==0 || XMLobj.readyState==4)
	{
		XMLobj.open("POST", "../../_site/php/dataResults.php", true );
		XMLobj.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); 
		XMLobj.onreadystatechange=show_news_drink;
		XMLobj.send(params2);
	}
}

function post_news_bar()
{
	if(XMLobj1.readyState==0 || XMLobj1.readyState==4)
	{
		XMLobj1.open("POST", "../../_site/php/dataResults.php", true );
		XMLobj1.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); 
		XMLobj1.onreadystatechange=show_news_bar;
		XMLobj1.send(params3);
	}
}
//

//	 function to display in the div
function showing()
{
	if(XMLobj2.readyState==4)
	{
		if(XMLobj2.status==200)
		{
			document.getElementById("resultData").innerHTML=XMLobj2.responseText;
			$(document).ready(function(){
			$("a[rel^='prettyPhoto']").prettyPhoto();			
		});
		
			$(document).ready(function(){
			$("a.media").media({autoplay: true});
			});

			$(document).ready(function(){
			$("div[class='slideshow2']").cycle({
				fx:     'fade', 
				speed:  'fast', 
				timeout: 0, 
				next:   '#next2', 
				prev:   '#prev2' 
			});		
		});
			$(document).ready(function(){
			$("div[class='slideshow3']").cycle({
				fx:     'turnDown', 
				speed:   6000, 
				timeout: 10, 
				pause:   1 
			});		
		});


	 	}
	 	else
	 		document.getElementById("resultData").innerHTML="Loading...";	//	showing the progressbar
	}
}

function show_news_drink()
{

	if(XMLobj.readyState==4)
	{
		if(XMLobj.status==200)
		{
	 		document.getElementById("resultData").innerHTML=XMLobj.responseText;
			$(document).ready(function(){
			$("a[rel^='prettyPhoto']").prettyPhoto();			
		});

			$(document).ready(function(){
			$("div[class='slideshow3']").cycle({
				fx:     'turnDown', 
				speed:  50000, 
				delay: -70000,
				pause: 1
			});		
		});			
	 	}
	 	else
	 		document.getElementById("resultData").innerHTML="Loading...";	//	showing the progressbar
	}

}


function show_news_bar()
{
	if(XMLobj1.readyState==4)
	{
		if(XMLobj1.status==200)
		{
	 		document.getElementById("resultData1").innerHTML=XMLobj1.responseText;
			$(document).ready(function(){
			$("a[rel^='prettyPhoto']").prettyPhoto();			
		});

			$(document).ready(function(){
			$("div[class='slideshow3']").cycle({
				fx:     'turnDown', 
				speed:  50000, 
				delay: -70000,
				pause: 1
			});		
		});			
	 	}
	 	else
	 		document.getElementById("resultData1").innerHTML="Loading...";	//	showing the progressbar
	}
}
