﻿function ajaxobject()
{
   var ajaxRequest;  // The variable that makes Ajax possible!
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}	
		}
	}
	return ajaxRequest;
}
function getdata_indiv(divid,pageurl,frmname,scrolldiv)
{
//var currentTime = new Date()
//alert(currentTime.getSeconds());
if (divid!="toppings")
{
	jQuery('#load_divid').show();
    jQuery('#inloaddiv').show();
}

    
    //J("#inloaddiv").animate({top: '-=100px'}, "slow");
  //document.getElementById(divid).innerHTML="Wait";
   var ajaxRequest=ajaxobject();
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function()
	{
	
		if(ajaxRequest.readyState == 4  && ajaxRequest.status == 200)
		{
	if (divid=="mycustomscroll")
	{
	var str_var=ajaxRequest.responseText;
	//str_var=str_var.replace('<form name="dd" method="post" action="gvmeal.aspx?catid=9041&amp;action=menu&amp;check_res=open" id="dd">','')
	//document.write(str_var);
	//alert(str_var.indexOf('<form name="dd" method="post" action="gvmeal.aspx?catid=9041&amp;action=menu&amp;check_res=open" id="dd">',0));
	
	jQuery("#"+divid).html(str_var);
	}
	else{jQuery("#"+divid).html(ajaxRequest.responseText);}
		
        // document.getElementById(divid).innerHTML=ajaxRequest.responseText;
           //document.getElementById(divid).style.overflow="auto";
           
       if (scrolldiv!=undefined && scrolldiv!="")
           {
                    if (scrolldiv=="Toppings.aspx")
                    {
                    fleXenv.fleXcrollMain("mycustomscrolls");
                    fleXenv.fleXcrollMain("mycustomscroll_inner");
                    replaceChecks();
                    }
                 else if (scrolldiv=="halfnhalf.aspx")
                    {
                    
                    fleXenv.fleXcrollMain("mycustomscrolls_top");
                    fleXenv.fleXcrollMain("mycustomscrolls_right");
                    fleXenv.fleXcrollMain("mycustomscroll_left");
                    fleXenv.fleXcrollMain("mycustomscroll_inner_right");
                    replaceChecks();
                    }
	            else if (scrolldiv=="itemdiv")
	                {
	                fleXenv.fleXcrollMain(scrolldiv);
	                }
	          }
	           if (divid=="menuid")
                    {
                    jQuery('#gallery a').lightBox();
                    }
	          
	          jQuery('#load_divid').hide();
		      jQuery('#inloaddiv').hide();
              //jQuery('#inloaddiv').stop();
	     }
	}
	
	ajaxRequest.open("GET", pageurl, true);
	ajaxRequest.send(null);
	}




function setdata(divid,pageurl,frmname)
{
  jQuery("#"+divid).html("Wait...");
   var ajaxRequest=ajaxobject();  
   ajaxRequest=null;
   ajaxRequest=ajaxobject();

	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4  && ajaxRequest.status == 200)
		{
		jQuery("#"+divid).html(ajaxRequest.responseText);
          //document.getElementById(divid).innerHTML=ajaxRequest.responseText;
	   }
	}
	ajaxRequest.open("GET", pageurl, true);
	ajaxRequest.send(null);
}

function getdata_intxt(txt,pageurl,frmname)
{
  //jQuery("#"+txt).val("Wait...");
   var ajaxRequest=ajaxobject();  // The variable that makes Ajax possible!
	
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4  && ajaxRequest.status == 200)
		{
          //document.getElementById(txt).value=ajaxRequest.responseText;
          jQuery("#"+txt).val(ajaxRequest.responseText);
        
	   }
	}
	ajaxRequest.open("GET", pageurl, true);
	ajaxRequest.send(null);
}