 var Class = {
   create: function() {
     return function() {
       if (this.initialize) {
         this.initialize();
       }
     }
   }
 }  
 
WebWindow = Class.create();
WebWindow.prototype = {
	initialize: function() {}
}

/* We define a firebug logger and a null logger (for the null logger, when you call WebWindow.log.debug("Your message") it does nothing */

WebFirebugLogger = Class.create();
WebFirebugLogger.prototype = {
	initialize: function() {},
	
	debug: function() {
		if (console != null) {
			console.debug.apply(this, arguments);
		}
	},
	info: function() {
		if (console != null) {
			console.info.apply(this, arguments);
		}
	},
	error: function() {
		if (console != null) {
			console.error.apply(this, arguments);
		}
	}	
	
};

WebNullLogger = Class.create();
WebNullLogger.prototype = {
	initialize: function() {},
	debug: function() {},
	info: function() {},
	error: function() {}
};


/** Install the logger. **/
try
{
	if (console && console.debug)
	{
		WebWindow.log = new WebFirebugLogger();
		WebWindow.log.debug("Log created.");
	} else {
		WebWindow.log = new WebNullLogger();
	}
}
catch(ex)
{
	// Firebug not installed, use null logger.
	WebWindow.log = new WebNullLogger();
	
}


var AddressAjax = {
	searchTimer: null,
	checkPostcode: function(suburbinput,suburbindicator,suburblister, stateinput, categoryId)
	{
		if (AddressAjax.searchTimer != null)
		{
			clearTimeout(AddressAjax.searchTimer);
			AddressAjax.searchTimer = null;
		}					
		var postcode = $(suburbinput).value;	
		$("state_lister").hide()		
		if (!isNaN(postcode) && postcode.length >= 4)
		{
			$(suburbindicator).show();
			AddressAjax.searchTimer = setTimeout(function()
			{		
				new Ajax.Request("/query/suburbs.aspx", {
					method: 'get',
					parameters: $H({postcode: $(suburbinput).value,category: categoryId,listerCtrl: suburblister,suburbCtrl: $(suburbinput).id,stateCtrl:stateinput}).toQueryString(),					
					onSuccess: function(request)
					{
					
						$(suburblister).update(request.responseText).show();						
					},
					onComplete: function(request)
					{
						$(suburbindicator).hide();
						//alert(request.responseText);
					},
					evalScripts: true
				});
				clearTimeout(AddressAjax.searchTimer);
				AddressAjax.searchTimer = null;			
			}, 500);			
		}
		else if (isNaN(postcode))
		{
			$(suburbindicator).show();
			AddressAjax.searchTimer = setTimeout(function()
			{
				new Ajax.Request("/query/suburbs.aspx", {
					method: 'get',
					parameters: $H({suburb: postcode,state:$(stateinput).value, category: categoryId,listerCtrl: suburblister,suburbCtrl: $(suburbinput).id,stateCtrl:stateinput}).toQueryString(),										
					onSuccess: function(request)
					{						
						$(suburblister).update(request.responseText).show();												
					},
					onComplete: function()
					{
						$(suburbindicator).hide();
					},					
					evalScripts: true
				});
				clearTimeout(AddressAjax.searchTimer);
				AddressAjax.searchTimer = null;			
			}, 500);
		
		}
		else
		{
			$(suburbindicator).hide();
			$(suburblister).update('');
		}
	},
	getStreetTypes: function(streettypeinput,streettypeindicator,streettypelister)
	{
		if (AddressAjax.searchTimer != null)
		{
			clearTimeout(AddressAjax.searchTimer);
			AddressAjax.searchTimer = null;
		}							
		$(streettypeindicator).show();
		AddressAjax.searchTimer = setTimeout(function()
		{		
			new Ajax.Request("/street_type.php", {
				method: 'get',parameters: $H({listerCtrl:streettypelister,streetTypeCtrl:$(streettypeinput).id}),					
				onSuccess: function(request)
				{
					$(streettypelister).update(request.responseText).show();						
				},
				onComplete: function(request)
				{
					$(streettypeindicator).hide();
					//alert(request.responseText);
				},
				evalScripts: true
			});
			clearTimeout(AddressAjax.searchTimer);
			AddressAjax.searchTimer = null;			
		}, 500);					
	},
	getStates: function()
	{
		if (AddressAjax.searchTimer != null)
		{
			clearTimeout(AddressAjax.searchTimer);
			AddressAjax.searchTimer = null;
		}
		$("suburb_lister").hide()							
		$("state_indicator").show();
		AddressAjax.searchTimer = setTimeout(function()
		{		
			new Ajax.Request("/query/states.aspx", {
				method: 'get',parameters:'',					
				onSuccess: function(request)
				{
					$("state_lister").update(request.responseText).show();						
				},
				onComplete: function(request)
				{
					$("state_indicator").hide();
					//alert(request.responseText);
				},
				evalScripts: true
			});
			clearTimeout(AddressAjax.searchTimer);
			AddressAjax.searchTimer = null;			
		}, 500);					
	}
}
var Price =
{
	searchTimer: null,	
	getPriceFrom: function()
		{
		if (Price.searchTimer != null)
		{
			clearTimeout(Price.searchTimer);
			Price.searchTimer = null;
		}
		$("state_lister").hide()
		$("suburb_lister").hide()
		Price.searchTimer = setTimeout(function()
		{		
			new Ajax.Request("/query/pricefrom.aspx", {
				method: 'get',parameters:'',					
				onSuccess: function(request)
				{
					$("pricefrom_lister").update(request.responseText).show();						
				},
				onComplete: function(request)
				{					
				},
				evalScripts: true
			});
			clearTimeout(Price.searchTimer);
			Price.searchTimer = null;			
		}, 500);
	},
		getPriceTo: function()
		{
		if (Price.searchTimer != null)
		{
			clearTimeout(Price.searchTimer);
			Price.searchTimer = null;
		}
		Price.searchTimer = setTimeout(function()
		{		
			new Ajax.Request("/query/priceto.aspx", {
				method: 'get',parameters:'',					
				onSuccess: function(request)
				{
					$("priceto_lister").update(request.responseText).show();						
				},
				onComplete: function(request)
				{					
				},
				evalScripts: true
			});
			clearTimeout(Price.searchTimer);
			Price.searchTimer = null;			
		}, 500);
	}						
}
	
var BidRegister = 
{
	secondsTimer: null,
	timeRemaining: null,
	stage2Timer:null,
	getBids: function(propertyId)
		{	
			BidRegister.clearTimer();			
			$.ajax({
				url: 'bidregister.aspx',
				cache: false,
				timeout: 500,
				data:"id="+propertyId,
				error: function(){
					$('#bidregister').html('<img src="images/ajaxloader2.gif" style="position:relative;top:40px;left:95px;"> ');					
				},
				success: function(html){				
					$('#bidregister').html(html);
					WebWindow.log.debug('Call Get Bids : Success');	
					WebWindow.log.debug('Total Seconds Remaining: ' + $('#total_seconds_remaining').val());	
					WebWindow.log.debug('True Time Remaining: ' + $('#true_time_remaining').val());				
					WebWindow.log.debug('True Time Remaining: ' + $('#auction_stage').val());															
					WebWindow.log.debug('--------------------------------------------------------------------');
					//Determine the stage of the auction.
																			
					if($('#total_seconds_remaining').val() > 30)
					{
						$('#gavel').hide();				
					}
					if($('#started').val()=="False")
					{
						WebWindow.log.debug('Call Auction Advertised');
						BidRegister.auctionAdvertised();	
						return 0;
					}
					
	/*
					if($('#auction_stage').val()=="ThreeHour")
					{
						WebWindow.log.debug('Call Three Hour');					
						BidRegister.threeHourTimer();
					}
					else if($('#auction_stage').val()=="TenMinute")
					{
						WebWindow.log.debug('Call Ten Minute');					
						BidRegister.threeHourTimer();
					}	
					else if($('#auction_stage').val() =="FirstCall")
					{
						WebWindow.log.debug('Call FirstCall');					
						BidRegister.firstCall();
					}
					else if($('#auction_stage').val() =="SecondCall")
					{
						WebWindow.log.debug('Call Three Hour');					
						BidRegister.threeHourTimer();									
					}
					else if($('#auction_stage').val() =="ThirdCall")
					{
						WebWindow.log.debug('Call Auction Commenced');					
						BidRegister.auctionCommenced();									
					}
					
					if($('#auction_stage').val() =="ThreeHour")
					{
						BidRegister.stage2Timer=true;
					}
					else
					{
						BidRegister.stage2Timer=null;	
					}	
	*/
	
	
					if($('#true_time_remaining').val() <=0)
					{
						WebWindow.log.debug('Call Auction End');					
						BidRegister.auctionEnd();
					}
					else if($('#true_time_remaining').val() <= 10800 && $('#total_seconds_remaining').val() > 90)
					{
						WebWindow.log.debug('Call Three Hour');					
						BidRegister.threeHourTimer();									
					}
					else if($('#true_time_remaining').val() >= 10800)
					{
						WebWindow.log.debug('Call Auction Commenced');					
						BidRegister.auctionCommenced();									
					}
					
					if($('#true_time_remaining').val() <= 600)
					{
						BidRegister.stage2Timer=true;
					}
					else
					{
						BidRegister.stage2Timer=null;	
					}					
	/**/
	
					
					
	/* old style calls

																			
					if($('#total_seconds_remaining').val() <=0)
					{
						WebWindow.log.debug('Call Auction End');					
						BidRegister.auctionEnd();
					}
					else if($('#total_seconds_remaining').val() <= 10800 && $('#total_seconds_remaining').val() > 90)
					{
						WebWindow.log.debug('Call Three Hour');					
						BidRegister.threeHourTimer();									
					}
					else if($('#total_seconds_remaining').val() >= 10800)
					{
						WebWindow.log.debug('Call Auction Commenced');					
						BidRegister.auctionCommenced();									
					}
					
					if($('#true_time_remaining').val() <= 600)
					{
						BidRegister.stage2Timer=true;
					}
					else
					{
						BidRegister.stage2Timer=null;	
					}					
	*/
	
					
					BidRegister.setCurrentBid();
					
					BidRegister.setTimeRemaining();
								
					BidRegister.timer();
				}
			});
		},
	setCurrentBid: function()
		{
			$('#label_current_bid').html($('#current_bid').val());
		},	
	clock: function()
		{				
			$.ajax({
				url: '/query/clock.aspx',
				timeout: 500,
				error: function(){
					//$('#auctionstatusbox').html('');
					BidRegister.clock();
				},
				success: function(html){
					$('#auctionstatusbox').html(html);					
				}
			});
		},
	timer: function()
		{			
							
			BidRegister.secondsTimer = setInterval(function()
				{
					WebWindow.log.debug('Call Timer');	
					BidRegister.timeRemaining.setSeconds(BidRegister.timeRemaining.getSeconds()-1);
					//alert(BidRegister.timeRemaining);
					var secondstring="";
					var minutestring="";
					var hourstring="";
					//alert(secondstring.length);
					secondstring=BidRegister.timeRemaining.getSeconds().toString();
					minutestring=BidRegister.timeRemaining.getMinutes().toString();
					hourstring=BidRegister.timeRemaining.getHours().toString();	
					if (isNaN(BidRegister.timeRemaining.getSeconds()))
					{
					secondstring = "0";
					minutestring = "0";
					hourstring = "0";
					}
													
					if($('#auction_stage').val()=="ThreeHour")
					{	
						if(secondstring <=0 && minutestring<=0 && hourstring<=0)
						{
							WebWindow.log.debug('Call Ten Minute Timer');	
							BidRegister.adjustTimer(0,10,0);							
							secondstring=BidRegister.timeRemaining.getSeconds().toString();
							minutestring=BidRegister.timeRemaining.getMinutes().toString();
							hourstring=BidRegister.timeRemaining.getHours().toString();								
							$('#auction_stage').val("TenMinute");
							BidRegister.tenMinuteTimer();									
						}
						else
						{
							WebWindow.log.debug('Call Three Hour Timer');
							BidRegister.threeHourTimer();
						}																			
					}
					else if($('#auction_stage').val()=="TenMinute")
					{
						if(secondstring <=0 && minutestring<=0 && hourstring<=0)
						{
							WebWindow.log.debug('Call First Call Timer');	
							BidRegister.adjustTimer(0,0,30);							
							secondstring=BidRegister.timeRemaining.getSeconds().toString();
							minutestring=BidRegister.timeRemaining.getMinutes().toString();
							hourstring=BidRegister.timeRemaining.getHours().toString();								
							$('#auction_stage').val("FirstCall");
							BidRegister.firstCall();			
						}
						else
						{
							WebWindow.log.debug('Call Ten Minute Timer');
							BidRegister.threeHourTimer();
						}
					}	
					else if($('#auction_stage').val() =="FirstCall")
					{
						if(secondstring <=0 && minutestring<=0 && hourstring<=0)
						{
							WebWindow.log.debug('Call Second Call Timer');	
							BidRegister.adjustTimer(0,0,30);							
							secondstring=BidRegister.timeRemaining.getSeconds().toString();
							minutestring=BidRegister.timeRemaining.getMinutes().toString();
							hourstring=BidRegister.timeRemaining.getHours().toString();								
							$('#auction_stage').val("SecondCall");
							BidRegister.secondCall();			
						}
						else
						{
							WebWindow.log.debug('Call First Call Timer');
							BidRegister.firstCall();
						}
					}
					else if($('#auction_stage').val() =="SecondCall")
					{
						if(secondstring <=0 && minutestring<=0 && hourstring<=0)
						{
							WebWindow.log.debug('Call Third Call Timer');	
							BidRegister.adjustTimer(0,0,30);							
							secondstring=BidRegister.timeRemaining.getSeconds().toString();
							minutestring=BidRegister.timeRemaining.getMinutes().toString();
							hourstring=BidRegister.timeRemaining.getHours().toString();	
							$('#auction_stage').val("ThirdCall");							
							BidRegister.thirdCall();		
						}
						else
						{
							WebWindow.log.debug('Call Second Call Timer');
							BidRegister.secondCall();
						}
					}
					else if($('#auction_stage').val() =="ThirdCall")
					{
						if(secondstring <=0 && minutestring<=0 && hourstring<=0)
						{
							WebWindow.log.debug('Call Auction End');								
							secondstring=BidRegister.timeRemaining.getSeconds().toString();
							minutestring=BidRegister.timeRemaining.getMinutes().toString();
							hourstring=BidRegister.timeRemaining.getHours().toString();
							$('#auction_stage').val("AuctionEnd");								
							BidRegister.auctionEnd();		
						}
						else
						{
							WebWindow.log.debug('Call Third Call Timer');
							BidRegister.thirdCall();
						}							
					}
					 					
					//alert(secondstring.length);
					if(secondstring.length < 2)
						secondstring= "0" + secondstring;
					if(minutestring.length < 2)
						minutestring= "0" + minutestring;
					if(hourstring.length < 2)
						hourstring= "0" + hourstring;		
					
					$('#second').html(secondstring);
					$('#minute').html(minutestring);
					$('#hour').html(hourstring);
				},1000);			
		},
	setTimeRemaining: function()
		{
			BidRegister.timeRemaining = new Date($('#time_remaining').val()) ;
			if ($('#hours_remaining').val() != "")
			{
				if($('#hours_remaining').val().toString().length < 2)						
					$('#hour').html("0" + $('#hours_remaining').val().toString());
				else
					$('#hour').html($('#hours_remaining').val().toString());	
			}
			if ($('#minutes_remaining').val() != "")
			{
				if($('#minutes_remaining').val().toString().length < 2)						
					$('#minute').html("0" + $('#minutes_remaining').val().toString());
				else
					$('#minute').html($('#minutes_remaining').val().toString());											
			}
			if ($('#seconds_remaining').val() != "")
			{
				if($('#seconds_remaining').val().toString().length < 2)						
					$('#second').html("0" + $('#seconds_remaining').val().toString());
				else
					$('#second').html($('#seconds_remaining').val().toString());						
			}
		},	
	adjustTimer: function(hours,minutes,seconds)
		{
			BidRegister.timeRemaining.setHours(hours);
			BidRegister.timeRemaining.setSeconds(seconds);
			BidRegister.timeRemaining.setMinutes(minutes);
			$('#hour').html("00");		
		},		
	clearTimer: function(timer)
		{
			clearInterval(BidRegister.secondsTimer);	
		},
	auctionAdvertised: function()
		{
			$('#bidregisterwrap').hide();
			$('#auctionstatusbox').html('<div class="auctioncommenced">AUCTION STARTS:<br>' + $('#start_time').val() + ' AEDST</div>');
			$('#clock').hide();
			$('#finalbids').html('');
			$('#message').html('This Auction has not yet commenced.<br>Register your interest to be notified when it has begun.');
			$('#clockheader').html('TIME REMAINING');
			$('#clockheader').css('color','#ea7501');			
			$("#currentbidpanel").css("background-image","none");			
			$(".currentbid").css("color","#00286b");
			$(".auctionstatusbox").css("background-color","#ea7501");
			$(".buttonbid").css("background-image","url(/images/btn1c.gif)");			
			if($('#reservemet').val()!="True")
			{
				$(".currentbidlabel").css("color","#00286b");
			}			
		},		
	auctionCommenced: function()
		{
			$('#auctionstatusbox').html('<div class="auctioncommenced">AUCTION COMMENCED</div>');
			$('#clock').hide();
			$('#finalbids').html('');
			$('#clockheader').html('TIME REMAINING');
			$('#clockheader').css('color','#ea7501');			
			$("#currentbidpanel").css("background-image","none");			
			$(".currentbid").css("color","#00286b");
			$(".auctionstatusbox").css("background-color","#ea7501");
			$(".buttonbid").css("background-image","url(/images/btn1c.gif)");			
			if($('#reservemet').val()!="True")
			{
				$(".currentbidlabel").css("color","#00286b");
			}	
		},		
	threeHourTimer:	function()
		{
			$('#auctionstatusbox').html('<div class="auctioncommenced">AUCTION CLOSING NOW!</div>');
			$('#clock').show();
			$('#finalbids').html('FINAL BIDS');
			$('#clockheader').html('TIME REMAINING');			
			$('#clockheader').css('color','#ea7501');			
			$("#currentbidpanel").css("background-image","none");			
			$(".currentbid").css("color","#00286b");
			$(".auctionstatusbox").css("background-color","#ea7501");
			$(".buttonbid").css("background-image","url(/images/btn1c.gif)");			
			if($('#reservemet').val()!="True")
			{
				$(".currentbidlabel").css("color","#00286b");
			}	
		},
	tenMinuteTimer:	function()
		{
			$('#auctionstatusbox').html('<div class="auctioncommenced">AUCTION CLOSING NOW!</div>');
			$('#clock').show();
			$('#finalbids').html('FINAL BIDS');
			$('#clockheader').html('TIME REMAINING');			
			$('#clockheader').css('color','#ea7501');			
			$("#currentbidpanel").css("background-image","none");			
			$(".currentbid").css("color","#00286b");
			$(".auctionstatusbox").css("background-color","#ea7501");
			$(".buttonbid").css("background-image","url(/images/btn1c.gif)");			
			if($('#reservemet').val()!="True")
			{
				$(".currentbidlabel").css("color","#00286b");
			}	
		},		
	threeMinuteTimer:	function()
		{
			$(".buttonbid").css("background-image","url(/images/animated_bidnow.gif)");		
		},										
	firstCall:	function()
		{
			$('#clock').show("slow");
			$('#finalbids').html('FIRST CALL');
			$('#clockheader').html('FIRST CALL');
			$('#clockheader').css('color','#FFFF00');			
			$(".auctionstatusbox").css("background-color","#FF0000");
			$("#currentbidpanel").css("background-image","url(/images/fbg.gif)");			
			$(".currentbid").css("color","#ffffff");
			$(".auctionstatusbox").css("background-color","#FF0000");
			$(".buttonbid").css("background-image","url(/images/btn2b.gif)");			
			if($('#reservemet').val()!="True")
			{
				$(".currentbidlabel").css("color","#ffffff");
			}	
		},
	secondCall:	function()
		{
			$('#clock').show("slow");		
			$('#finalbids').html('SECOND CALL');
			$('#clockheader').html('SECOND CALL');
			$('#clockheader').css('color','#FFFF00');			
			$(".auctionstatusbox").css("background-color","#FF0000");
			$("#currentbidpanel").css("background-image","url(/images/fbg.gif)");			
			$(".currentbid").css("color","#ffff00");
			$(".auctionstatusbox").css("background-color","#FF0000");
			$(".buttonbid").css("background-image","url(/images/btn2b.gif)");			
			if($('#reservemet').val()!="True")
			{
				$(".currentbidlabel").css("color","#ffffff");
			}	
		},
	thirdCall:	function()
		{
			$('#clock').show("slow");
			$('#finalbids').html('THIRD CALL & FINAL CALL');
			$('#clockheader').html('THIRD CALL & FINAL CALL');
			$('#clockheader').css('color','#FFFF00');
			$(".auctionstatusbox").css("background-color","#FF0000");
			$("#currentbidpanel").css("background-image","url(/images/fbg.gif)");			
			$(".currentbid").css("color","#ffffff");
			$(".auctionstatusbox").css("background-color","#FF0000");
			$(".buttonbid").css("background-image","url(/images/btn2b.gif)");			
			if($('#reservemet').val()!="True")
			{
				$(".currentbidlabel").css("color","#ffffff");
			}
			$('#bidregisterwrap').hide();			
			var showgavel;														
			showgavel = $('#gavel:visible').length;
			if(showgavel==0)
			{
			$('#gavel').html('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="335" height="200" id="gavel" align="middle" VIEWASTEXT><param name="allowFullScreen" value="false" /><param name="wmode" value="transparent"><param name="movie" value="/images/gavel_hover.swf" /><param name="quality" value="best" /><param name="bgcolor" value="#faedc7" /><embed src="/images/gavel_hover.swf" quality="best" wmode="transparent" bgcolor="#faedc7" width="335" height="200" name="gavel" align="middle" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>').show();
			}													
		},
	auctionEnd: function()
		{
			$('#auctionstatusbox').html('<div class="auctioncommenced">AUCTION IS COMPLETED</div>');
			$(".auctionstatusbox").css("background-color","#ea7501");
			$('#clock').hide();
			$('#bid_button').hide();				
			$("#currentbidpanel").css("background-image","none");
			$(".currentbid").css("color","#ea7501");
			$('#curentbidlabel').html('FINAL BID').css('color','#00286b');
			if($('#reservemet').val()=="True")
			{
				$('#finalbids').html('SOLD').css('text-align','center').css('font-size','72px');
			}
			else
			{
				$('#finalbids').html('FOR NEGOTIATION').css('font-size','42px').css('line-height','42px');
			}							
			$('#clockheader').css('color','#FF0000');
			$('#gavel').html('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="335" height="200" id="gavel" align="middle" VIEWASTEXT><param name="allowFullScreen" value="false" /><param name="wmode" value="transparent"><param name="movie" value="http://flash.sale-ezy.com.au/images/gavel2.swf" /><param name="quality" value="best" /><param name="bgcolor" value="#faedc7" /><embed src="http://flash.sale-ezy.com.au/images/gavel2.swf" quality="best" wmode="transparent" bgcolor="#faedc7" width="335" height="200" name="gavel" align="middle" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>').show();
			//clearInterval(timer1);			
		}														
}

var Login2 = {
	validate: function()
	{
		var message="";
		if($("ulid").value=="")
			message+="<li>User id not supplied";		
		if($("ulpassword").value=="")
			message+="<li>Password not supplied";
		if(message.length > 0)
		{
			$("validator").update(message).show();	
			return false;
		}
		else
		{
			$("validator").update(message).hide();
			return true;	
		}	
	}
}
var User3 = 
{
	login: function()
		{
		$.ajax({
				type: "POST",
				url: 'userlogin.aspx',
				timeout: 5000,
				data:$("#frmlogin").serialize(),
				error: function(){
					$('#validator').html("<li>User does not exist!</li>").show();
				},
				success: function(html){
					parent.location.href = 'bidconditions.aspx';								
				}
			});		
		}
}
var User2 = 
{
	login: function()
		{
		
		new Ajax.Request("/userlogin.aspx", {
					method: 'post',
					parameters: $('frmlogin').serialize(),					
					onSuccess: function(request)
					{
					
						$('login').update(request.responseText).show();						
					},
					onComplete: function(request)
					{
						//$('validator').update("<li>User does not exist!</li>").show()
						//alert(request.responseText);
					},
					onError: function(request)
					{
					$('validator').update("<li>User does not exist!</li>").show()
					},
					on500: function(request)
					{
					$('validator').update("<li>User does not exist!</li>").show()
					},
					evalScripts: true
				});
				
		
		}
}		



var User = 
{
	login: function()
		{				
			$.ajax({
				type: "POST",
				url: 'userlogin.aspx',
				timeout: 5000,
				data:$("#frmlogin").serialize(),
				error: function(){
					$('#validator').html("<li>User does not exist!</li>").show();
				},
				success: function(html){
					$('#login').html('<script>window.location.reload();</script>');
					$('#menuItemMyAuction').show();									
				}
			});
		},
	addWatch: function()
		{	var currentTime = new Date();					
			$.ajax({				
				url: '/query/addwatch.aspx',
				data: 'dummy='+currentTime.getTime(),
				timeout: 5000,				
				error: function(){
					
				},
				success: function(html){
					$("#details").html('<script>window.location.reload();</script>');
				}
			});
		},
	removeWatch: function(propertyId)
		{	var currentTime = new Date();		
			$('#btn_remove'+propertyId).hide();			
			$.ajax({				
				url: '/query/removewatch.aspx',
				data:'id='+propertyId+'&dummy='+currentTime.getTime(),
				timeout: 5000,				
				error: function(){
					//alert('test');
				},
				success: function(html){
					//alert(html);
					User.getWatched();	
				}
			});
		},
	getWatched: function()
		{		var currentTime = new Date();	
			$("#myauctions").load("/query/watching.aspx", { 'dummy': currentTime.getTime() } );	
			/*
			$.ajax({				
				url: '/query/watching.aspx',
				data: 'dummy='+currentTime.getTime(),
				timeout: 5000,				
				error: function(){
					
				},
				success: function(html){
					//alert(html);
					$("#myauctions").html(html);
				}
			});*/
		},
	getAuctions: function()
		{	var currentTime = new Date();					
			$.ajax({				
				url: '/query/bidding.aspx',
				data: 'dummy='+currentTime.getTime(),
				timeout: 5000,				
				error: function(){
					
				},
				success: function(html){
					$("#myauctions").html(html);
				}
			});
		},
	getWon: function()
		{	var currentTime = new Date();					
			$.ajax({				
				url: '/query/won.aspx',
				data: 'dummy='+currentTime.getTime(),
				timeout: 5000,				
				error: function(){
					
				},
				success: function(html){
					$("#myauctions").html(html);
				}
			});
		},
	getNotWon: function()
		{	var currentTime = new Date();					
			$.ajax({				
				url: '/query/notwon.aspx',
				data: 'dummy='+currentTime.getTime(),
				timeout: 5000,				
				error: function(){
					
				},
				success: function(html){
					$("#myauctions").html(html);
				}
			});
		}						
}
