function call_ajax(cur_page, seg, cid, view)
{ 
	   data = document.frm.pagesize.value;
	   s_type = document.frm.s_type.value;
	   url = 'item_display.php?psize='+data+'&s_type='+s_type+'&cur_page='+cur_page+'&seg='+seg+'&cid='+cid+'&view='+view;
	 
	   divid = 'productListing';  
	   ajax(url,divid);
}

function call_ajax1(cur_page, seg, cid, view)
{	
	data = document.frm.pagesize.value;
	s_type = document.frm.s_type.value;
   	url = 'item_display.php?seg='+seg+'&psize='+data+'&s_type='+s_type+'&cur_page='+cur_page+'&cid='+cid+'&view='+view;
	//alert(url);
	divid = 'productListing';  
	ajax(url,divid);	
}

function cart_ajax()
{
	n = document.frm.qty_id.length;
	val = '';
	str = '';
	for( i=0; i<n; i++)
	{
		x = document.frm.qty_id[i].value;
        y = document.frm.cart_id[i].value;
		str +=  x + '|';
		val += y + '|';
	}
	url = 'cart_item_display.php?str='+str+'&val='+val;
	alert(url);
	divid = 'cart_item';
	ajax(url,divid);	
}

function get_checked_value(radio)
{
	len=radio.length;
	for(i=0;i<len;i++)
		if(radio[i].checked)
	return radio[i].value;
}

function ajax_alert(url)
{
	var xmlHttp = false;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
		alert ("Browser does not support HTTP Request");
	else
	{
		xmlHttp.onreadystatechange=
			function ()
				{
				if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
					{
						if(xmlHttp.responseText.length>0)
							alert(xmlHttp.responseText);
						}
					};
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
	}
}

function GetXmlHttpObject()
{
	if (window.XMLHttpRequest)
		return (new XMLHttpRequest());
	else if (window.ActiveXObject)
		return (new ActiveXObject("Microsoft.XMLHTTP"));
}

function ajax(url,divid)
{
// alert(url);
 //alert(divid);
var xmlHttp = false;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
		alert ("Browser does not support HTTP Request");
	else
	{
		xmlHttp.onreadystatechange=
			function ()
				{
				if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
				    {  
					    
						document.getElementById(divid).innerHTML=xmlHttp.responseText; 
						
					}
					};
		xmlHttp.open("GET",url,true);
		//window.open(url);
		xmlHttp.send(null);
	}
	
}
function fx(){
AJS.fx={_shades:{0:"ffffff",1:"ffffee",2:"ffffdd",3:"ffffcc",4:"ffffbb",5:"ffffaa",6:"ffff99"},highlight:function(_1,_2){
var _3=new AJS.fx.Base();
_3.elm=AJS.$(_1);
_3.options.duration=600;
_3.setOptions(_2);
AJS.update(_3,{increase:function(){
if(this.now==7){
_1.style.backgroundColor="#fff";
}else{
_1.style.backgroundColor="#"+AJS.fx._shades[Math.floor(this.now)];
}
}});
return _3.custom(6,0);
},fadeIn:function(_4,_5){
_5=_5||{};
if(!_5.from){
_5.from=0;
AJS.setOpacity(_4,0);
}
if(!_5.to){
_5.to=1;
}
var s=new AJS.fx.Style(_4,"opacity",_5);
return s.custom(_5.from,_5.to);
},fadeOut:function(_7,_8){
_8=_8||{};
if(!_8.from){
_8.from=1;
}
if(!_8.to){
_8.to=0;
}
_8.duration=300;
var s=new AJS.fx.Style(_7,"opacity",_8);
return s.custom(_8.from,_8.to);
},setWidth:function(_a,_b){
var s=new AJS.fx.Style(_a,"width",_b);
return s.custom(_b.from,_b.to);
},setHeight:function(_d,_e){
var s=new AJS.fx.Style(_d,"height",_e);
return s.custom(_e.from,_e.to);
}};
AJS.fx.Base=new AJS.Class({init:function(_10){
this.options={onStart:function(){
},onComplete:function(){
},transition:AJS.fx.Transitions.sineInOut,duration:500,wait:true,fps:50};
AJS.update(this.options,_10);
AJS.bindMethods(this);
},setOptions:function(_11){
AJS.update(this.options,_11);
},step:function(){
var _12=new Date().getTime();
if(_12<this.time+this.options.duration){
this.cTime=_12-this.time;
this.setNow();
}else{
setTimeout(AJS.$b(this.options.onComplete,this,[this.elm]),10);
this.clearTimer();
this.now=this.to;
}
this.increase();
},setNow:function(){
this.now=this.compute(this.from,this.to);
},compute:function(_13,to){
var _15=to-_13;
return this.options.transition(this.cTime,_13,_15,this.options.duration);
},clearTimer:function(){
clearInterval(this.timer);
this.timer=null;
return this;
},_start:function(_16,to){
if(!this.options.wait){
this.clearTimer();
}
if(this.timer){
return;
}
setTimeout(AJS.$p(this.options.onStart,this.elm),10);
this.from=_16;
this.to=to;
this.time=new Date().getTime();
this.timer=setInterval(this.step,Math.round(1000/this.options.fps));
return this;
},custom:function(_18,to){
return this._start(_18,to);
},set:function(to){
this.now=to;
this.increase();
return this;
},setStyle:function(elm,_1c,val){
if(this.property=="opacity"){
AJS.setOpacity(elm,val);
}else{
AJS.setStyle(elm,_1c,val);
}
}});
AJS.fx.Style=AJS.fx.Base.extend({init:function(elm,_1f,_20){
this.parent();
this.elm=elm;
this.setOptions(_20);
this.property=_1f;
},increase:function(){
this.setStyle(this.elm,this.property,this.now);
}});
AJS.fx.Styles=AJS.fx.Base.extend({init:function(elm,_22){
this.parent();
this.elm=AJS.$(elm);
this.setOptions(_22);
this.now={};
},setNow:function(){
for(p in this.from){
this.now[p]=this.compute(this.from[p],this.to[p]);
}
},custom:function(obj){
if(this.timer&&this.options.wait){
return;
}
var _24={};
var to={};
for(p in obj){
_24[p]=obj[p][0];
to[p]=obj[p][1];
}
return this._start(_24,to);
},increase:function(){
for(var p in this.now){
this.setStyle(this.elm,p,this.now[p]);
}
}});
AJS.fx.Transitions={linear:function(t,b,c,d){
return c*t/d+b;
},sineInOut:function(t,b,c,d){
return -c/2*(Math.cos(Math.PI*t/d)-1)+b;
}};
script_loaded=true;


script_loaded=true;
	
}
function toggle(toggleId, e)
{
	if (!e)
	e = window.event;
	if (!document.getElementById)	return false;
	
	var body = document.getElementById(toggleId);
	
	if (!body)	return false;
	
	if (body.style.display == "none")
		body.style.display = "block";
	else	body.style.display = "none";
	
	if (e)
	{
	// Stop the event from propagating, which would cause the regular HREF link to be followed, ruining our hard work.
		e.cancelBubble = true;
		if (e.stopPropagation)	e.stopPropagation();
	}
}

function make_visible(id,bool, e)
{
	if (!e) e = window.event;
	
	if (!document.getElementById)	return false;
	
	var body = document.getElementById(id);
	
	if (!body)	return false;
	
	if (bool)	body.style.display = "block";
	else		body.style.display = "none";
	
	if (e)
	{
	// Stop the event from propagating, which would cause the regular HREF link to be followed, ruining our hard work.
	e.cancelBubble = true;
	if (e.stopPropagation)
	e.stopPropagation();
	}
}

function close_except(id)
{
	var divCollection = document.getElementsByTagName("div");
	for (var i=0; i<divCollection.length; i++) 
	{
		idofdiv=divCollection[i].getAttribute("id");
		if(idofdiv!=id && idofdiv!='') 
			make_visible(idofdiv,false); 				
	}
 }
 
function showarrow(id)  // for particular project -----------------------
{
	var spanCollection = document.getElementsByTagName("span");
	for (var i=0; i<spanCollection.length; i++) 
	{
		var idofspan=spanCollection[i].getAttribute("id");		
		if(idofspan.indexOf('arr') > -1 && idofspan!=id) 
			spanCollection[i].innerHTML='';
		else if(idofspan==id)
			spanCollection[i].innerHTML="<img src=\"images/square.jpg\">";
	}
	
 }
 
 
 function close_except_i(id)
{
	var divCollection = document.getElementsByTagName("div");
	
	for (var i=0; i<divCollection.length; i++) 
	{
		idofdiv=divCollection[i].getAttribute("id");
		if(idofdiv!=null)
		{
			tmp=idofdiv.toString();
			if(idofdiv!=id && tmp.indexOf("catdiv") > -1)
				make_visible(idofdiv,false); 							
		}
	}
 }
function isNumeric(sText)
{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;
 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
	{ 
		Char = sText.charAt(i); 
		if (ValidChars.indexOf(Char) == -1) 
		 IsNumber = false;
	}
   return IsNumber;
   
}



function ajax_post(url,divid)
{ 
 if(makAx())
 {
	 xm.onreadystatechange = 
 function ()
				{
				if (xm.readyState==4 || xm.readyState=="complete")
				    {  
					   
						document.getElementById(divid).innerHTML=xm.responseText; 
						
					}
					};

	sendRequest(url)
 }
	/*var xmlHttp = false;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
		alert ("Browser does not support HTTP Request");
	else
	{
		xmlHttp.onreadystatechange=
			function ()
				{
				if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
				    {  
					   
						document.getElementById(divid).innerHTML=xmlHttp.responseText; 
						
					}
					};
		xmlHttp.open("POST",url,true);
		window.open(url);
		xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		 var str = "";
		xmlHttp.send(str);
	}*/
	
}

var xm;
function sendRequest(url)
{	
	str = "msg=msg"
	xm.open("POST",url,true);
	if(navigator.userAgent.indexOf("Opera")!=-1)
		xm.setRequestHeader="Content-Type", "application/x-www-form-urlencoded";	
	else
		xm.setRequestHeader ("Content-Type", "application/x-www-form-urlencoded");	
	xm.send(str)
}


function makAx(){

	try {
	  xm = new ActiveXObject("Msxml2.XMLHTTP");
	  return true;
	} catch (e) {
	  try {
		xm = new ActiveXObject("Microsoft.XMLHTTP");
		return true;
	  } catch (e2) {
		xm = false;
	  }
	}
	
	if (!xm && typeof XMLHttpRequest != 'undefined') {
	  xm = new XMLHttpRequest();
	  return true;
}

	
}