var xmlHttp;
imageDir = "image-directory/";

function createXMLHttpRequest()
{
	if (window.ActiveXObject)
	{
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else if (window.XMLHttpRequest)
	{
		xmlHttp = new XMLHttpRequest();
	}
}

function handleStateChange()
{
	if(xmlHttp.readyState == 4)
	{
		if(xmlHttp.status == 200)
		{
		   var strActualValue=xmlHttp.responseText;
		   document.getElementById("ajaxVenueId").innerHTML=strActualValue;		 
		}
	}
}

//Start: Evaluate Case
function populateVenue(categoryId,venueid)
{		
		createXMLHttpRequest();
		xmlHttp.onreadystatechange = handleStateChange;
		//alert(venueid); // used at the time of edit
		// at the time of insert venueid is passed zero by force
		// at the time of edit venueid is passed as in db for that perticular itemid of a property
		var currentTime = new Date().getTime();
		xmlHttp.open("GET", "AjaxVenuesForProprty.php?categoryId="+categoryId+"&venueid="+venueid+"&timestamp="+currentTime, true);
		xmlHttp.send(null);
}

function populateAuctionDate(venueid)
{
		createXMLHttpRequest();
		xmlHttp.onreadystatechange = handleStateChange2;
		var currentTime = new Date().getTime();
		xmlHttp.open("GET", "AjaxAuctionDateForProprty.php?venueid="+venueid+"&timestamp="+currentTime, true);
		xmlHttp.send(null);
}

function handleStateChange2()
{
	if(xmlHttp.readyState == 4)
	{
		if(xmlHttp.status == 200)
		{
		   var strActualValue=xmlHttp.responseText;
  	       bothDates = strActualValue.split("||");

			if(bothDates != "")
			{
				   stdate = bothDates[0];
				   enddate = bothDates[1];
				   //expected - 2009-08-29 01:52:52
				   //input - strActualValue="20091212101010";
					year = stdate.substr(0,4);
					month = stdate.substr(4,2);
					day = stdate.substr(6,2);
					hr = stdate.substr(8,2);
					min = stdate.substr(10,2);
					sec = stdate.substr(12,2);
					txtstdate = year+"-"+month+"-"+day+" "+hr+":"+min+":"+sec;

				   document.getElementById("auctionstartdate").value=txtstdate;	

					eyear = enddate.substr(0,4);
					emonth = enddate.substr(4,2);
					eday = enddate.substr(6,2);
					ehr = enddate.substr(8,2);
					emin = enddate.substr(10,2);
					esec = enddate.substr(12,2);
					txtenddate = eyear+"-"+emonth+"-"+eday+" "+ehr+":"+emin+":"+esec;
				   document.getElementById("auctionenddate").value=txtenddate;
			}
	    }
	}

}


function show_hide_reserveprice(obj)
{
	//alert(obj);
	if(obj=="1")
	{
		document.getElementById("reserveprice_block").style.visibility="visible" ;
		document.getElementById("reserveprice_block2").style.visibility="visible";
		/*document.getElementById("reserveprice_block").style.display="block" ;
		document.getElementById("reserveprice_block2").style.display="block";*/
	}
	else
	{
		document.getElementById("reserveprice_block").style.visibility="hidden" ;
		document.getElementById("reserveprice_block2").style.visibility="hidden";
		/*document.getElementById("reserveprice_block").style.display="none" ;
		document.getElementById("reserveprice_block2").style.display="none";*/
	}
}


function changeDefaultPhoto(defaultPictureId,itemId,pageTitle)
{		
	   createXMLHttpRequest();
		xmlHttp.onreadystatechange = handleStateChange3;
		var currentTime = new Date().getTime();
		URL = "AjaxChangeDefaultPhoto.php?defaultPictureId="+defaultPictureId+"&itemId="+itemId+"&pageTitle="+pageTitle+"&timestamp="+currentTime;

		//alert(URL);
		xmlHttp.open("GET", URL, true);
		xmlHttp.send(null);

}

function handleStateChange3()
{
	if(xmlHttp.readyState == 4)
	{
		if(xmlHttp.status == 200)
		{
		   var strActualValue=xmlHttp.responseText;
		   document.getElementById("hid_photolist").innerHTML=strActualValue;	
	    }
	}

}

function updateDocTitle(docid)
	{	
		editedValue = document.getElementById("txtDocTitle["+docid+"]").value;
		createXMLHttpRequest();
		xmlHttp.onreadystatechange = handleStateChange4;

		var currentTime = new Date().getTime();
		URL = "AjaxEditDocTitle.php?editedValue="+editedValue+"&docid="+docid+"&timestamp="+currentTime;
		//alert(URL);
		xmlHttp.open("GET", URL, true);
		xmlHttp.send(null);
	}	

function handleStateChange4()
{
	if(xmlHttp.readyState == 4)
	{
		if(xmlHttp.status == 200)
		{
		   var strActualValue=xmlHttp.responseText;
		  // alert(strActualValue);
		   rstext = strActualValue.split("~`~||~`~");
		   //alert(rstext[0]);
		   //alert(rstext[1]);
		   docid = rstext[0];
		   docTitle = rstext[1];
		   docTitlehref = rstext[2];
   	       docTitle = docTitle.replace("'","@@");

		   btn = '<INPUT TYPE="button" name="editTitle" value="Edit Title" onclick="javascript:putTextboxForTitle(\''+docid+'\',\''+docTitle+'\');">';

			//alert(btn);
		   document.getElementById("DocTitle["+docid+"]").innerHTML=docTitlehref;
		   document.getElementById("btn["+docid+"]").innerHTML=btn;
	    }

	}

}

function handleVenueChange4LiveProperty()
{
	if(xmlHttp.readyState == 4)
	{

		if(xmlHttp.status == 200)
		{
		   var strActualValue=xmlHttp.responseText;
		   document.getElementById("ajaxPropertyList").innerHTML=strActualValue;
		   /**/
            var active_tour_top = $('#ajaxPropertyList');                                    
            $(' #ajaxPropertyList:visible').hide();
            active_tour_top.fadeIn(2400);
			/**/
          
		}

	}
}

function populateOnLineProperties(categoryId, venueId, pageNum)
{		
	//alert(categoryId +"||"+ venueid);

	document.getElementById("ajaxPropertyList").innerHTML='<center><br><IMG SRC="'+imageDir+'ajax-loader.gif"><br></center>';
	elementID = "chk_"+venueId;
	createXMLHttpRequest();
	xmlHttp.onreadystatechange = handleVenueChange4LiveProperty;
	var currentTime = new Date().getTime();
	URL = "AjaxPopulateOnLineProperty.php?categoryId="+categoryId+"&venueId="+venueId+"&pageNum="+pageNum+"&timestamp="+currentTime;
	//alert(URL);
	xmlHttp.open("GET", URL, true);
	xmlHttp.send(null);

}

var offsetfrommouse=[15,45];
var defaultimageheight = 500;	// maximum image size.
var defaultimagewidth = 500;	// maximum image size.

function truebody(){
return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function showimage(picPath,PropertyID,Street,State,Zip,City,Type,Bed,Bath,SqFt,YearBuilt,OccupancyStatus,LotSize)
{
	if(Type == "")
	{
		Type ="--";		
	}
	width = 400;
	newHTML='';
	newHTML+='<div class="border_preview" STYLE="WIDTH:400PX">';
	
	newHTML+= '<div class="preiviewHeading" STYLE="WIDTH:400PX">&nbsp;Item # '+PropertyID+' | '+Street+' '+State+' '+Zip+'</div>';

	newHTML+='<div class="clearboth">';
	newHTML+='<div class="floatLeft widthLeft">City:</div>';
	newHTML+='<div class="floatLeft widthRight">'+City+'</div>';
	newHTML+='<div class="floatLeft widthLeft">Proprty Type:</div>';
	newHTML+='<div CLASS="floatLeft widthRight">'+Type+'</div>';
	newHTML+='</div>';
	
	newHTML+='<div class="clearboth">';
	newHTML+='<div class="floatLeft widthLeft">Square Footage:</div>';
	newHTML+='<div class="floatLeft widthRight">'+SqFt+'</div>';
	newHTML+='<div class="floatLeft widthLeft">Year Built:</div>';
	newHTML+='<div class="floatLeft widthRight">'+YearBuilt+'</div>';
	newHTML+='</div>';
	
	newHTML+='<div class="clearboth">';
	newHTML+='<div class="floatLeft widthLeft">Occupancy Status:</div>';
	newHTML+='<div class="floatLeft widthRight">'+OccupancyStatus+'</div>';
	newHTML+='<div class="floatLeft widthLeft">Lot Size:</div>';
	newHTML+='<div CLASS="floatLeft widthRight">'+LotSize+'</div>';
	newHTML+='</div>';
	
	newHTML+='<div class="clearboth">';
	newHTML+='<div class="floatLeft widthLeft">No. of Baths:</div>';
	newHTML+='<div class="floatLeft widthRight">'+Bath+'</div>';
	newHTML+='<div class="floatLeft widthLeft">No. of Beds:</div>';
	newHTML+='<div class="floatLeft widthRight">'+Bed+'</div>';
	newHTML+='</div>';
	/////////////



	newHTML+='<div style="height:10"></div>';
	

	//document.getElementById("preview_div").innerHTML=newHTML;
	if(picPath != '--')
	{
	newHTML+='<div>';
	
	propertyPhoto = "<center><img src='"+picPath+"' class='photoBorder' width='400' height='300'></center>";
	newHTML+=propertyPhoto;

	newHTML+='</div>';
	
	}

	newHTML+='<div style="height:10"></div>';
	newHTML+='</div>';

	
	document.onmousemove=followmouse; 
	//alert(newHTML);
	document.getElementById("preview_div").style.display='block';
    document.getElementById("preview_div").innerHTML=""+newHTML+"";
	
    /**/ 

	/*var active_tour_top = $('#preview_div');                                    

	$(' #preview_div:visible').hide();

	active_tour_top.fadeIn(250);
	*/
	/**/

}

function runEffect(effectName,divId){
		//get effect type from 
			var selectedEffect = effectName;

       		//most effect types need no options passed by default
			var options = {};
			//check if it's scale, transfer, or size - they need options explicitly set
			if(selectedEffect == 'scale'){ options = {percent: 0}; }
			else if(selectedEffect == 'transfer'){ options = { to: "#button", className: 'ui-effects-transfer' }; }
			else if(selectedEffect == 'size'){ options = { to: {width: 200,height: 60} }; }
	
			//run the effect
			$(divId).effect(selectedEffect,options,500,callback);

		}

//callback function to bring a hidden box back
function callback(){
		setTimeout(function(){
		$(divId+":hidden").removeAttr('style').hide().fadeIn();
			}, 1000);

		}

function hideImage()
{
	document.getElementById("preview_div").style.display='none';
    propertyId_hover='';
}


function followmouse(e){
	var xcoord=offsetfrommouse[0];
	var ycoord=offsetfrommouse[1];

	var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-10;
	var docheight=document.all? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(window.innerHeight);

	if (typeof e != "undefined"){

		if (docwidth - e.pageX < defaultimagewidth + 2*offsetfrommouse[0]){

			xcoord = e.pageX - xcoord - defaultimagewidth; // Move to the left side of the cursor

		} else {

			xcoord += e.pageX;

		}

		if (docheight - e.pageY < defaultimageheight + 2*offsetfrommouse[1]){

			ycoord += e.pageY - Math.max(0,(2*offsetfrommouse[1] + defaultimageheight + e.pageY - docheight - truebody().scrollTop));

		} else {

			ycoord += e.pageY;

		}



	} else if (typeof window.event != "undefined"){

		if (docwidth - event.clientX < defaultimagewidth + 2*offsetfrommouse[0]){

			xcoord = event.clientX + truebody().scrollLeft - xcoord - defaultimagewidth; // Move to the left side of the cursor

		} else {

			xcoord += truebody().scrollLeft+event.clientX

		}

		if (docheight - event.clientY < (defaultimageheight + 2*offsetfrommouse[1])){

			ycoord += event.clientY + truebody().scrollTop - Math.max(0,(2*offsetfrommouse[1] + defaultimageheight + event.clientY - docheight));

		} else {

			ycoord += truebody().scrollTop + event.clientY;

		}

	}

	document.getElementById("preview_div").style.left=xcoord+"px";

	document.getElementById("preview_div").style.top=ycoord+"px";

}

function showBidHistory(itemId,divId)
{
		var xmlHttp;
		
		document.getElementById(divId).style.display='block';
		document.getElementById(divId).innerHTML='<span><center><br><IMG SRC="'+imageDir+'ajax-loader.gif"><br></center></span>';

		if (window.XMLHttpRequest)     // Object of the current windows
		{ 
		    xmlHttp = new XMLHttpRequest();     // Firefox, Safari, ...
		} 
		else if (window.ActiveXObject)   // ActiveX version
		 {
		    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");  // Internet Explorer 
		 } 
		 try {
	     xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");    // Trying Internet Explorer  
         }
	     catch(e)    // Failed 
	     {
	     xmlHttp = new XMLHttpRequest();    // Other browsers.
	     }
		var url;

		var currentTime = new Date().getTime();

		url="AjaxBidHistory.php";

		url=url+"?itemId="+itemId;

		url=url+"&divId="+divId;

		url=url+"&timestamp="+currentTime;

		xmlHttp.onreadystatechange=function() {

		if(xmlHttp.readyState == 4)
			{

				if(xmlHttp.status == 200)
				{

				   var strActualValue=xmlHttp.responseText;

				   document.getElementById(divId).innerHTML=strActualValue;

				    /**/
					divIdd = "#"+divId;
					var active_tour_top = $(divIdd);                                    
					$(' '+divIdd+':visible').hide();
					active_tour_top.fadeIn(2400);
					/**/

				}

			}

		};

		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);

 }



function hideBidHistory(divId)
{
	document.getElementById(divId).style.display='none';
}

function form_submit()
{
	Arr_checkBox = document.getElementsByName('venue[]');
	var Arr_chkVenueID=new Array();

	Str_chkVenueID = "";
	cnt = 0;

	for(i =0; i < Arr_checkBox.length; i++)
	{
		if(Arr_checkBox[i].checked)
		{	
			if(cnt>0)
			{
				Str_chkVenueID+=","+Arr_checkBox[i].value;

			}
			else
			{
				Str_chkVenueID+=Arr_checkBox[i].value;
			}

			//Arr_chkVenueID[i] = Arr_checkBox[i].value;
			cnt++;

		}
	}
	

	if(Str_chkVenueID.length == 0)
	{
		Str_chkVenueID = "";		
	}

	if(Str_chkVenueID == "undefined")
	Str_chkVenueID = "";
	state 		= document.search_listing.state.value;
	city 		= document.search_listing.city.value;
	bedroom 	= document.search_listing.bedroom.value;
	bathroom 	= document.search_listing.bathroom.value;
	squareFeet 	= document.search_listing.squareFeet.value;
	prop_type 	= document.search_listing.prop_type.value;
	built_year	= document.search_listing.built_year.value;
	address		= document.search_listing.address.value;
	itemno 		= document.search_listing.itemno.value;
	propid 		= document.search_listing.propid.value;
	catalogid 	= document.search_listing.catalogid.value;
	county 		= document.search_listing.county.value;


	params = catalogid+"|@|"+Str_chkVenueID+"|@|"+state+"|@|"+city+"|@|"+bedroom+"|@|"+bathroom+"|@|"+squareFeet+"|@|"+prop_type+"|@|";

	params+= built_year+"|@|";
	params+= address+"|@|"+itemno+"|@|"+propid+"|@|"+county;

	//alert(params);
	populateSearchedProperties(params,0);
	return false;
}

function populateSearchedProperties(params,pageNum)
{		
		
    	divId = "ajaxPropertyList";

		document.getElementById(divId).style.display='block';

		document.getElementById(divId).innerHTML='<span><center><br><br><br><br><br><br><br><br><br><br><br><IMG SRC="'+imageDir+'ajax-loader.gif"><br><br><br><br><br><br><br><br><br><br></center></span>';

		if (window.XMLHttpRequest)     // Object of the current windows
		{ 
		    xmlHttp = new XMLHttpRequest();     // Firefox, Safari, ...
		} 
		else if (window.ActiveXObject)   // ActiveX version
		 {
		    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");  // Internet Explorer 
		 } 

		 try {

	    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");    // Trying Internet Explorer  

	      }

	    catch(e)    // Failed 

	     {

	     xmlHttp = new XMLHttpRequest();    // Other browsers.

	     }

		var url;

		var currentTime = new Date().getTime();

		url="AjaxSearchProperty.php";

		url=url+"?params="+params;

		url=url+"&pageNum="+pageNum;		

		url=url+"&timestamp="+currentTime;
	


		//xmlHttp.open("GET", url, true);
		xmlHttp.onreadystatechange=function() {
		if(xmlHttp.readyState == 4)
			{
				if(xmlHttp.status == 200)
				{
				   var strActualValue;
				   strActualValue=xmlHttp.responseText;
				 
				   document.getElementById(divId).innerHTML=strActualValue;
				   //alert(strActualValue);
     			    /**/
					var active_tour_top = $('#ajaxPropertyList');                                    

					$(' #ajaxPropertyList:visible').hide();

					active_tour_top.fadeIn(2400);

					/**/

				}

			}

		};

		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
 }
 ////////////////////////////
 
function form_submit2()
{
	Arr_checkBox = document.getElementsByName('venue[]');
	var Arr_chkVenueID=new Array();

	Str_chkVenueID = "";
	cnt = 0;

	for(i =0; i < Arr_checkBox.length; i++)
	{
		if(Arr_checkBox[i].checked)
		{	
			if(cnt>0)
			{
				Str_chkVenueID+=","+Arr_checkBox[i].value;

			}
			else
			{
				Str_chkVenueID+=Arr_checkBox[i].value;
			}

			//Arr_chkVenueID[i] = Arr_checkBox[i].value;
			cnt++;

		}
	}
	

	if(Str_chkVenueID.length == 0)
	{
		Str_chkVenueID = "";		
	}

	if(Str_chkVenueID == "undefined")
	Str_chkVenueID = "";
	state 		= document.search_listing.state.value;
	city 		= document.search_listing.city.value;
	bedroom 	= document.search_listing.bedroom.value;
	bathroom 	= document.search_listing.bathroom.value;
	squareFeet 	= document.search_listing.squareFeet.value;
	prop_type 	= document.search_listing.prop_type.value;
	built_year	= document.search_listing.built_year.value;
	address		= document.search_listing.address.value;
	itemno 		= document.search_listing.itemno.value;
	propid 		= document.search_listing.propid.value;
	catalogid 	= document.search_listing.catalogid.value;
	county 		= document.search_listing.county.value;


	params = catalogid+"|@|"+Str_chkVenueID+"|@|"+state+"|@|"+city+"|@|"+bedroom+"|@|"+bathroom+"|@|"+squareFeet+"|@|"+prop_type+"|@|";

	params+= built_year+"|@|";
	params+= address+"|@|"+itemno+"|@|"+propid+"|@|"+county;

	//alert(params);
	populateSearchedProperties2(params,0);
	return false;
}

function populateSearchedProperties2(params,pageNum)
{		
		var xmlHttp; // do not delete this line, 
		/*
		// this has solved the problem not showing property data on 
		// /auction_details_online.php?auctionId=5607(any auction ID) ...
		// after quick clicking pagination number or next button
		*/
		
    	divId = "ajaxPropertyList";
		document.getElementById(divId).style.display='block';
			
		document.getElementById(divId).innerHTML='<span><center><br><br><br><br><br><br><br><br><br><br><br><IMG SRC="'+imageDir+'ajax-loader.gif"><br><br><br><br><br><br><br><br><br><br></center></span>';

		if (window.XMLHttpRequest)     // Object of the current windows
		{ 
		    xmlHttp = new XMLHttpRequest();     // Firefox, Safari, ...
		} 
		else if (window.ActiveXObject)   // ActiveX version
		 {
		    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");  // Internet Explorer 
		 } 

		 try {

	    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");    // Trying Internet Explorer  

	      }

	    catch(e)    // Failed 

	     {

	     xmlHttp = new XMLHttpRequest();    // Other browsers.

	     }

		var url;

		var currentTime = new Date().getTime();

		url="AjaxSearchProperty2.php";

		url=url+"?params="+params;

		url=url+"&pageNum="+pageNum;		

		url=url+"&timestamp="+currentTime;
	
		//alert(url);

		//xmlHttp.open("GET", url, true);
		xmlHttp.onreadystatechange=function() {
		if(xmlHttp.readyState == 4)
			{
				if(xmlHttp.status == 200)
				{
				   var strActualValue;
				   strActualValue=xmlHttp.responseText;
				   
				   data = strActualValue.split("`~`");
				   //document.getElementById(divId).innerHTML=strActualValue;
				   
				   //alert(data[0]);
				   //alert(data[1]);
				     if(data[0] != '' || data[0] != "undefined")
				     {
				     	if(document.getElementById("allItemIds"))
				     	{
				    		document.getElementById("allItemIds").value = data[0];
				     	}
				     }
				   
				   if(data[1]!='')
				   {
				   		if(document.getElementById(divId))
				   		{
				   			document.getElementById(divId).innerHTML=data[1];		  
				   		}
				   }
				  
				   
				  // alert(strActualValue);
     			    /**/
					var active_tour_top = $('#ajaxPropertyList');                                    

					$(' #ajaxPropertyList:visible').hide();

					active_tour_top.fadeIn(2400);

					/**/
					//updatedIds = document.getElementById("allItemIds2").value;
					//alert(1223+document.getElementById("allItemIds2").value);
					
				   //document.getElementById("allItemIds").value = updatedIds;
				   // alert("updatedIds : ");
				   //alert("1223"+document.getElementById("allItemIds").value);
				   
				   if(data[0] != '' || data[0] != "undefined")
				   {
				   		getUpdatedData();
				   }
				   

				}

			}

		};

		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
 }
 
////////////////auction calendar starts /////////////

function ajaxAuctionCalendar()
{
	Arr_checkBox = document.getElementsByName('auctions[]');
	var Arr_chkVenueID=new Array();
	Str_chkVenueID = "";
	cnt = 0;

	for(i =0; i < Arr_checkBox.length; i++)
	{
		if(Arr_checkBox[i].checked)
		{	
			if(cnt>0)
			{
				Str_chkVenueID+=","+Arr_checkBox[i].value;

			}
			else
			{
				Str_chkVenueID+=Arr_checkBox[i].value;
			}

			//Arr_chkVenueID[i] = Arr_checkBox[i].value;
			cnt++;

		}
	}
	
	if(Arr_checkBox[0].checked)
	{
		online=1;
	}
	else
	{
		online=0;
	}
	
	if(Arr_checkBox[1].checked)
	{
		conventional=1;
	}
	else
	{
		conventional=0;
	}
	
	if(Arr_checkBox[2].checked)
	{
		all=1;
	}
	else
	{
		all=0;
	}
	
	

	

	//alert(params);
	populateAuctionCalendar(online,conventional,all);
	return false;
}

function ajaxAuctionCalendar_post(obj)
{
	Arr_checkBox = document.getElementsByName('auctions[]');
	var Arr_chkVenueID=new Array();
	Str_chkVenueID = "";
	cnt = 0;

	for(i =0; i < Arr_checkBox.length; i++)
	{
		if(Arr_checkBox[i].checked)
		{	
			if(cnt>0)
			{
				Str_chkVenueID+=","+Arr_checkBox[i].value;

			}
			else
			{
				Str_chkVenueID+=Arr_checkBox[i].value;
			}

			//Arr_chkVenueID[i] = Arr_checkBox[i].value;
			cnt++;
		}
	}
	
	if(Arr_checkBox[0].checked)
	{
		online=1;
	}
	else
	{
		online=0;
	}
	
	if(Arr_checkBox[1].checked)
	{
		conventional=1;
	}
	else
	{
		conventional=0;
	}
	
	if(Arr_checkBox[2].checked)
	{
		all=1;
	}
	else
	{
		all=0;
	}
	
	if(obj == 1)
	{
		all = 0;
		conventional = 0;
	}
	if(obj == 2)
	{
		all = 0;
		online = 0;
	}
	if(obj == 3)
	{
		conventional = 0;
		online = 0;
	}	
	//alert(params);
	document.getElementById("id_online").value= online;
	document.getElementById("id_conventional").value= conventional;
	document.getElementById("id_all").value= all;
	
	
	
	document.frm.submit();
	return false;
}

function populateAuctionCalendar(online,conventional,all)
{		
		
    	divId = "calendarList";
    	//document.getElementById("idcountdown").innerHTML =""
    	//document.getElementById(divId).innerHTML="";
		
		document.getElementById(divId).style.display='block';

		document.getElementById(divId).innerHTML='<span><center><br><br><br><br><br><br><br><br><br><br><br><IMG SRC="'+imageDir+'ajax-loader.gif"><br><br><br><br><br><br><br><br><br><br></center></span>';

		if (window.XMLHttpRequest)     // Object of the current windows
		{ 
		    xmlHttp = new XMLHttpRequest();     // Firefox, Safari, ...
		} 
		else if (window.ActiveXObject)   // ActiveX version
		 {
		    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");  // Internet Explorer 
		 } 

		 try {

	    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");    // Trying Internet Explorer  

	      }

	    catch(e)    // Failed 

	     {

	     xmlHttp = new XMLHttpRequest();    // Other browsers.

	     }

		var url;

		var currentTime = new Date().getTime();

		url="AjaxAuctionCalendar.php";
		url=url+"?online="+online;
		url=url+"&conventional="+conventional;
		url=url+"&all="+all;
		
		url=url+"&timestamp="+currentTime;
       
		//xmlHttp.open("GET", url, true);
		xmlHttp.onreadystatechange=function() {
		if(xmlHttp.readyState == 4)
			{
				if(xmlHttp.status == 200)
				{
				   var strActualValue;
				   strActualValue=xmlHttp.responseText;
				 
				   document.getElementById(divId).innerHTML=strActualValue;
     			    /**/
					var active_tour_top = $('#calendarList');                                    

					$(' #calendarList:visible').hide();

					active_tour_top.fadeIn(2400);

					/**/

				}

			}

		};

		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
 }
 


//////////////auction calendar ends //////////////
 
 function save_listing(itemid, divID)

{


		if (window.XMLHttpRequest)     // Object of the current windows

		{ 

		    xmlHttp = new XMLHttpRequest();     // Firefox, Safari, ...

		} 

	  else if (window.ActiveXObject)   // ActiveX version

		 {

		    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");  // Internet Explorer 

		 } 

		 try {

	    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");    // Trying Internet Explorer  

	      }

	    catch(e)    // Failed 

	     {

	     xmlHttp = new XMLHttpRequest();    // Other browsers.

	     }

		var url;

		var currentTime = new Date().getTime();

		url="savelisting.php";

		url=url+"?ItemId="+itemid;

		url=url+"&timestamp="+currentTime;



		xmlHttp.onreadystatechange=function() {

		if(xmlHttp.readyState == 4)

			{

				if(xmlHttp.status == 200)

				{

				   var strActualValue=xmlHttp.responseText;

				   //document.getElementById(divID).innerHTML=strActualValue;
				 //  alert(strActualValue);
				   if(strActualValue != '')
				   {
						showDialog(strActualValue);
						//
				   }


				}

			}

		};

		xmlHttp.open("GET",url,true);

		xmlHttp.send(null);


}

///////////////////////////////////////////////////////////////////////	
function showDialog(obj)
{	
	
	if(obj == 1)
	{
		str_msg = "<b>Saved!!!</b><br><br>This property have been saved in your listing.";
		$.prompt(str_msg);
	}
	if(obj == 2)
	{
		str_msg = "<b>Already Saved !!!</b><br><br>You have already saved this property to your listing.";
		$.prompt(str_msg);
			
	}
	if(obj == 3)
	{
		
		str_msg = "<b>Please Login !!!</b><br><br>Please Login to save this property into your listing.";
		$.prompt(str_msg);
	}
}

//	showDialog(1);
///////////////////////////////////////////////////////////////////////	
function bidOnTheFly(id, bid)
{	
	
	if(id != "" && bid != '')
	{	
		url = "bidOnTheFly.php?id="+id+"&bid="+bid;
		str_msg = "<iframe width='578' height='380px' border=0 style='border:0px' src='"+url+"' />";
		$.prompt(str_msg);
	}
	/*if(obj == 2)
	{
		str_msg = "<b>Already Saved !!!</b><br><br>You have already saved this property to your listing.";
		$.prompt(str_msg);
			
	}
	if(obj == 3)
	{
		
		str_msg = "<b>Please Login !!!</b><br><br>Please Login to save this property into your listing.";
		$.prompt(str_msg);
	}*/
}

//	showDialog(1);
///////////////////////////////////////////////////////////////////////	

function fedInEffect(divId)
{	
	DIVIDS = '#'+divId
	var active_tour_top = $(DIVIDS);
						
	$('"'+DIVIDS+':visible'+'"').hide();
	active_tour_top.fadeIn(1400);
} 
///////////////////////////////////////////////////////////////////////	