$(document).ready(function(){







    // Variable to hold auction data



    var auctions = '';



    var auctionObjects = new Array();







    // Collecting auction data, the layer id and auction id



    $('.auction-item').each(function(){



        var auctionId    = $(this).attr('id');



        var auctionTitle = $(this).attr('title');







        if($('#' + auctionId + ' .countdown').length){



            // collect the id for post data



            auctions = auctions + auctionId + '=' + auctionTitle + '&';







            // collect the object



            auctionObjects[auctionId]                           = $('#' + auctionId);



          



            auctionObjects[auctionId]['countdown']              = $('#' + auctionId + ' .countdown');

			if(auctionObjects[auctionId]['countdown'].attr('style'))
			{
				//alert(auctionObjects[auctionId]['countdown'].attr('style'));
				  auctionObjects[auctionId]['flash-elements']         = $('#' + auctionId + ' .bid-price, #' + auctionId + ' .bid-bidder, #' + auctionId+ ' .bid-savings-price, #' + auctionId + ' .bid-savings-percentage, #' + auctionId + ' .closes-on');
			}
			else
			{
				  auctionObjects[auctionId]['flash-elements']         = $('#' + auctionId + ' .countdown, #' + auctionId + ' .bid-price, #' + auctionId + ' .bid-bidder, #' + auctionId+ ' .bid-savings-price, #' + auctionId + ' .bid-savings-percentage, #' + auctionId + ' .closes-on');
			}

            auctionObjects[auctionId]['closes-on']              = $('#' + auctionId + ' .closes-on');



            auctionObjects[auctionId]['bid-bidder']             = $('#' + auctionId + ' .bid-bidder');
			
			  auctionObjects[auctionId]['top-auction']             = $('#' + auctionId + ' .top-auction');



            auctionObjects[auctionId]['bid-button']             = $('#' + auctionId + ' .bid-button');

		  auctionObjects[auctionId]['bidbutler-button']             = $('#' + auctionId + ' .bidbutler-button');

            auctionObjects[auctionId]['bid-button-a']           = $('#' + auctionId + ' .bid-button a');



            auctionObjects[auctionId]['bid-button-p']           = $('#' + auctionId + ' .bid-button p');



            auctionObjects[auctionId]['bid-price']              = $('#' + auctionId + ' .bid-price');

				auctionObjects[auctionId]['cd_uhr']        = $('#' + auctionId + ' .cd_uhr');
				auctionObjects[auctionId]['expensebids']        = $('#' + auctionId + ' .expensebids');
				auctionObjects[auctionId]['expensebids2']        = $('#' + auctionId + ' .expensebids2');



            auctionObjects[auctionId]['bid-price-fixed']        = $('#' + auctionId + ' .bid-price-fixed');



            auctionObjects[auctionId]['bid-loading']            = $('#' + auctionId + ' .bid-loading');



            auctionObjects[auctionId]['bid-message']            = $('#' + auctionId + ' .bid-message');



            auctionObjects[auctionId]['bid-flash']              = $('#' + auctionId + ' .bid-flash');



            auctionObjects[auctionId]['bid-savings-price']      = $('#' + auctionId + ' .bid-savings-price');



            auctionObjects[auctionId]['bid-savings-percentage'] = $('#' + auctionId + ' .bid-savings-percentage');



            auctionObjects[auctionId]['bid-bookbidbutler']      = $('#' + auctionId + ' .bid-bookbidbutler');







            auctionObjects[auctionId]['bid-histories']          = $('#bidHistoryTable' + auctionTitle);



            auctionObjects[auctionId]['bid-histories-p']        = $('#bidHistoryTable' + auctionTitle + ' p');



            auctionObjects[auctionId]['bid-histories-tbody']    = $('#bidHistoryTable' + auctionTitle + ' tbody');

 auctionObjects[auctionId]['revealprice']              = $('#' + auctionId + ' .revealprice');
			  auctionObjects[auctionId]['revealprice-link']              = $('#' + auctionId + ' .revealprice-link');
			  auctionObjects[auctionId]['time-increment']              = $('#' + auctionId + ' .time-increment');
			   auctionObjects[auctionId]['time-incrementcounter']              = $('#' + auctionId + ' .time-incrementcounter');
			   auctionObjects[auctionId]['bid-newprice']              = $('#' + auctionId + ' .bid-newprice');
			    auctionObjects[auctionId]['new-newprice']              = $('#' + auctionId + ' .new-newprice');
				auctionObjects[auctionId]['start_time']              = $('#' + auctionId + ' .start_time');
				auctionObjects[auctionId]['last_looked']              = $('#' + auctionId + ' .last_looked');
				auctionObjects[auctionId]['last_lookedprice']              = $('#' + auctionId + ' .last_lookedprice');
				auctionObjects[auctionId]['last_lookedsaveprice']              = $('#' + auctionId + ' .last_lookedsaveprice');

        }



    });







    // additional object



    var bidOfficialTime        = $('.bid-official-time');



    var bidBalance             = $('.bid-balance');
	
	 var totalsavings             = $('.Counter_Text');



    var price                  = '';



    var priceFixed             = '';



    var getstatus_url_time;



    var getstatus_url;







    if($('.bid-histories').length){



        getstatus_url = '/getstatus.php?histories=yes&ms=';



    }else{



        getstatus_url = '/getstatus.php?ms=';



    }







 function convertToNumber(sourceString){
        return sourceString.replace(/&#[0-9]{1,};/gi, "")
                            .replace(/&[a-z]{1,};/gi, "")
                            .replace(/[a-zA-Z]+/gi, "")
                            .replace(/[^0-9\,\.]/gi, "");
    }








    // Do the loop when auction available only



    if(auctions){



        setInterval(function(){


 timeExam();
            getstatus_url_time = getstatus_url + new Date().getTime();



            $.ajax({



                url: getstatus_url_time,



                dataType: 'json',



                type: 'POST',



                data: auctions,



                success: function(data){



                    if(data[0]){



                        if(data[0].Auction.serverTimeString){



                            if(bidOfficialTime.html()){



                                bidOfficialTime.html(data[0].Auction.serverTimeString);



                            }



                        }


//alert(totalsavings)
						if(totalsavings.html()){

							//alert(data[0].Auction.totalsavingprice)

                                totalsavings.html(data[0].Auction.totalsavingprice);



                            }




                        if(data[0].Balance){

							//alert(bidBalance.innerHTML)

                            if(document.getElementById("bid-balance")){



                               document.getElementById("bid-balance").innerHTML=data[0].Balance.balance;



                            }



                        }



                    }







                    $.each(data, function(i, item){

						

						if(auctionObjects[item.Auction.element]['cd_uhr'].html())

						{

							auctionObjects[item.Auction.element]['cd_uhr'].html(item.Auction.countmsg);

						}
						

						//alert(auctionObjects[item.Auction.element]['expensebids'])
						if(auctionObjects[item.Auction.element]['expensebids'])
						{
//alert(auctionObjects[item.Auction.element]['expensebids2'])
							auctionObjects[item.Auction.element]['expensebids'].html(item.Auction.expensebids);
							if(auctionObjects[item.Auction.element]['expensebids2'])
							{//alert(item.Auction.expensebids)
							     var tmp=Math.floor((item.Auction.expensebids2*item.Auction.expensebids)/100);
								auctionObjects[item.Auction.element]['expensebids2'].html(eval(tmp));
								//document.getElementById("expensebids2").innerHTML=Math.floor((item.Auction.expensebids2*item.Auction.expensebids)/100);
							}

						}
                        if(auctionObjects[item.Auction.element]['bid-price-fixed'].html()){







                            if(auctionObjects[item.Auction.element]['bid-price-fixed'].length > 1){



                                auctionObjects[item.Auction.element]['bid-price-fixed'].each(function(){



                                    price = $(this).html();



                                });



                            }else{



                                price = auctionObjects[item.Auction.element]['bid-price-fixed'].html();



                            }







                        }else{







                            if(auctionObjects[item.Auction.element]['bid-price'].length > 1){



                                auctionObjects[item.Auction.element]['bid-price'].each(function(){



                                    price = $(this).html();



                                });



                            }else{



                                price = auctionObjects[item.Auction.element]['bid-price'].html();



                            }







                        }







                       price = convertToNumber(price);







                        if(auctionObjects[item.Auction.element]['bid-bidder'].html() != item.LastBid.username){



                            auctionObjects[item.Auction.element]['bid-bidder'].html(item.LastBid.username);



                        }





						 auctionObjects[item.Auction.element]['start_time'].html(item.Auction.end_time_string);
						 auctionObjects[item.Auction.element]['last_looked'].html(item.Auction.lastreveal.created);
						  auctionObjects[item.Auction.element]['last_lookedprice'].html(item.Auction.lastreveal.price);
						   auctionObjects[item.Auction.element]['last_lookedsaveprice'].html(item.Auction.lastreveal.saveprice);

                        if(price != convertToNumber(item.Auction.price)){
					 //if(price != item.Auction.price){


                            auctionObjects[item.Auction.element]['bid-price'].html(item.Auction.price);



                            auctionObjects[item.Auction.element]['bid-price-fixed'].html(item.Auction.price);







                            if(auctionObjects[item.Auction.element]['bid-flash'] && item.Message){

								//alert(item.Message.message)

                                auctionObjects[item.Auction.element]['bid-flash'].html(item.Message.message).show(1).animate({opacity: 1.0}, 2000).hide(1);

								

                            }







                            if(auctionObjects[item.Auction.element]['bid-histories'].length){



                                if(auctionObjects[item.Auction.element]['bid-histories-p'].html()){



                                    auctionObjects[item.Auction.element]['bid-histories-p'].remove();



                                }







                                auctionObjects[item.Auction.element]['bid-histories-tbody'].empty();











                                $.each(item.Histories, function(n, tRow){



                                    var row = '<tr><td align="left">' + tRow.Bid.created + '</td><td align="left">' + tRow.User.username + '</td><td align="left">' + tRow.Bid.price + '</td></tr>';







                                    auctionObjects[item.Auction.element]['bid-histories-tbody'].append(row);



                                });







                                auctionObjects[item.Auction.element]['closes-on'].html(item.Auction.closes_on);



                                auctionObjects[item.Auction.element]['bid-savings-percentage'].html(item.Auction.savings.percentage);



                                auctionObjects[item.Auction.element]['bid-savings-price'].html(item.Auction.savings.price);



                            }







                          //  auctionObjects[item.Auction.element]['flash-elements'].effect("highlight", {}, 1500);



                        }



						



                        if(item.Auction.peak_only == 1 && item.Auction.isPeakNow == 0){



                            auctionObjects[item.Auction.element]['countdown'].html('<span style="font-size: 14px;">Closed til 8am</span>');


							if(auctionObjects[item.Auction.element]['top-auction'])
							{
								//alert(auctionObjects[auctionId]['countdown'].attr('style'));
								// auctionObjects[item.Auction.element]['countdown'].html('Paused');
							}
							else
							{
								auctionObjects[item.Auction.element]['countdown'].html('<span style="font-size: 14px;">Closed til 8am</span>');
							}
							//auctionObjects[item.Auction.element]['countdown'].html('Paused');

						


                            auctionObjects[item.Auction.element]['bid-button-a'].hide();



                            if(auctionObjects[item.Auction.element]['bid-button-p'].html() == ''){



                                auctionObjects[item.Auction.element]['bid-button'].append('<p>Peak Only Auction</p>');



                            }



                        }else{



                            if(item.Auction.end_time - item.Auction.serverTimestamp > 0){



                                
							//alert(auctionObjects[item.Auction.element]['countdown'].attr('style'))
//alert(auctionObjects[item.Auction.element]['top-auction'].value)
						    if(auctionObjects[item.Auction.element]['top-auction'])
							{
								//alert(auctionObjects[auctionId]['countdown'].attr('style'));
								// auctionObjects[item.Auction.element]['countdown'].html('Paused');
							}
							else
							{
								auctionObjects[item.Auction.element]['countdown'].html(item.Auction.end_time_string);
							}

							auctionObjects[item.Auction.element]['countdown'].html(item.Auction.end_time_string);


                                if(item.Auction.time_left <= 10){



                                    //auctionObjects[item.Auction.element]['countdown'].css('color', '#ff0000');
										
										 if(auctionObjects[item.Auction.element]['top-auction'])
										{
											//alert(auctionObjects[auctionId]['countdown'].attr('style'));
											// auctionObjects[item.Auction.element]['countdown'].html('Paused');
										}
										else
										{
											//auctionObjects[item.Auction.element]['countdown'].css('color', '#ff0000');
										}


                                }else{



                                    
									  if(auctionObjects[item.Auction.element]['top-auction'])
										{
											//alert(auctionObjects[auctionId]['countdown'].attr('style'));
											// auctionObjects[item.Auction.element]['countdown'].html('Paused');
										}
										else
										{
											auctionObjects[item.Auction.element]['countdown'].removeAttr('style');
										}
										
										//auctionObjects[item.Auction.element]['countdown'].removeAttr('style');



                                }



                            }







                            if(auctionObjects[item.Auction.element]['bid-button-p'].html()){



                                auctionObjects[item.Auction.element]['bid-button-a'].show();



                                auctionObjects[item.Auction.element]['bid-button-p'].remove();



                            }



                        }







                        if(item.Auction.time_left < 1 && item.Auction.closed == 1){



                            

							 
									/* if(auctionObjects[item.Auction.element]['countdown'].attr('style'))
										{
											//alert(auctionObjects[auctionId]['countdown'].attr('style'));
											// auctionObjects[item.Auction.element]['countdown'].html('Paused');
										}
										else
										{
											auctionObjects[item.Auction.element]['countdown'].html('ENDED');
										}*/
										//
										//alert("hi")
										auctionObjects[item.Auction.element]['countdown'].html('ENDED');
								
                           // auctionObjects[item.Auction.element]['bid-button'].hide();
						    

							if(auctionObjects[item.Auction.element]['time-increment'])auctionObjects[item.Auction.element]['time-increment'].html(0);
							if(auctionObjects[item.Auction.element]['time-incrementcounter'])auctionObjects[item.Auction.element]['time-incrementcounter'].html('Sold');;
							if(auctionObjects[item.Auction.element]['bid-newprice'])auctionObjects[item.Auction.element]['bid-newprice'].hide();
							auctionObjects[item.Auction.element]['bid-button'].html('Sold');
                            auctionObjects[item.Auction.element]['bid-bookbidbutler'].hide();



                        }



                    });



                },







                error: function(XMLHttpRequest, textStatus, errorThrown){



                    // nothing implement here



                    // have an idea?



                }



            });



        }, 1000);



    }else{



        if(bidOfficialTime.length){



            setInterval(function(){



                var gettime = '/gettime.php?' + new Date().getTime();



                $.ajax({



                    url: gettime,



                    success: function(data){



                        bidOfficialTime.html(data);



                    }



                });



            }, 1000);



        }



    }







    // Function for bidding



    $('.bid-button-link').click(function(){



        var auctionElement = 'auction_' + $(this).attr('title');







        auctionObjects[auctionElement]['bid-button'].hide(1);



        auctionObjects[auctionElement]['bid-loading'].show(1);



//alert(auctionElement)



        $.ajax({



            url: $(this).attr('href') + '&ms=' + new Date().getTime(),



            dataType: 'json',



            success: function(data){

//alert(data.Auction.message)
var str=data.Auction.message.trim();//alert(str)
				if(str=="Your bid was placed")
				{
						alert("GOOD LUCK \n Your bid has been accepted!")
				}
				else
				{
					alert("Your bid has not been accepted. This is either because: \n - You are already the highest bidder \n - You don't have the sufficient balance \n - The auction is closed until 8am in the morning \n - The item has been SOLD")
				}
             /*   auctionObjects[auctionElement]['bid-message'].html(data.Auction.message)



                                                             .show(1)



                                                             .animate({opacity: 1.0}, 2000)



                                                             .hide(1);*/







                auctionObjects[auctionElement]['bid-button'].show(1);



                auctionObjects[auctionElement]['bid-loading'].hide(1);



            }



        });







        return false;



    });




 // Function for bidding
    $('.uncoverbid-button-link').click(function(){
        var auctionElement = 'auction_' + $(this).attr('title');
		var id=$(this).attr('title');
       // auctionObjects[auctionElement]['bid-button'].hide(1);
       auctionObjects[auctionElement]['bid-loading'].show(1);
		
		
		
		//alert(auctionObjects[auctionElement]['bid-newprice']);
        $.ajax({
            url: $(this).attr('href') + '&ms=' + new Date().getTime(),
            dataType: 'json',
            success: function(data){
               /* auctionObjects[auctionElement]['bid-message'].html(data.Auction.message)
                                                             .show(1)
                                                             .animate({opacity: 1.0}, 2000)
                                                             .hide(1);*/

                //alert(data.Auction.price)
				if(data.Auction.message=="Price has been revealed")
				{
						var tmp='<a href="/closebid.php?id='+id+'" class="buybid-button-link" title="'+id+'">Buy </a>';
						var price = '<span class="new-newprice">' +data.Auction.price+'</span>' + tmp;
						auctionObjects[auctionElement]['bid-newprice'].html(price);
						auctionObjects[auctionElement]['bid-newprice'].show(1);
						auctionObjects[auctionElement]['bid-loading'].hide(1);
						auctionObjects[auctionElement]['bid-button'].hide(1);
						 //auctionObjects[auctionElement]['countdown'].effect("highlight", {color: "#ffff00"}, 1500);
                                                            
															 
						/* $('.buybid-button-link').click(function()
							{
								var auctionElement = 'auction_' + $(this).attr('title');
						//alert($(this).attr('href') + '&ms=' + new Date().getTime());
							   // auctionObjects[auctionElement]['bid-button'].hide(1);
									//alert(price);
								$.ajax({
									url: $(this).attr('href') + '&ms=' + new Date().getTime(),
									dataType: 'json',
									success: function(data){
										//alert(data.message);
										location.href=data.message;
										//startTime(auctionElement,0);
									}
								});
						
								return false;
							});*/
						 var cnt=0;
						 setInterval(function(){
											  cnt=cnt+1;
											  
											  //alert(cnt)
											   var tme=auctionObjects[auctionElement]['time-increment'].html();
											  if(eval(tme)-eval(cnt)>=0)
											  {
												 
												var tmpp=eval(tme)-eval(cnt);
												var tempp=eval(tmpp)+" Seconds";
												 auctionObjects[auctionElement]['time-incrementcounter'].html(tempp);
												  auctionObjects[auctionElement]['time-incrementcounter'].show(1);
												  if(eval(cnt)==eval(tme))
												  {
													  var price =  auctionObjects[auctionElement]['revealprice-link'].html();
													 // auctionObjects[auctionElement]['bid-button'].html(price);
													  auctionObjects[auctionElement]['bid-button'].show(1);
													  auctionObjects[auctionElement]['time-incrementcounter'].html(eval(tme));
													   auctionObjects[auctionElement]['time-incrementcounter'].hide(1);
													  auctionObjects[auctionElement]['bid-newprice'].hide(1);
													  
													 // cnt=0;
													}
											  }
											 }, 1000);
				}
				else
				{
					window.location="/packages";
					//alert("Insufficent credits to view this sale! \n      Please top up your credits.")
				}
				//startTime(auctionElement,0);
            }
        });

        return false;
    });
	
	
	



    // Function to check limit and change the icon whenever it's changed



    // Run only when bid icon available



    if($('.bid-limit-icon').length){



        setInterval(function(){



            var count = $('.bid-limit-icon').length



            if(count > 0){



                $.ajax({



                    url: '/limits/getlimitsstatus/?ms=' + new Date().getTime(),



                    dataType: 'json',



                    success: function(data){



                        if(data){



                            $('.bid-limit-icon').each(function(i){



                                if(data[i].image){



                                    $(this).attr('src', '/img/'+data[i].image);



                                }



                            });



                        }



                    }



                });



            }



        }, 30000);



    }







    if($('.productImageThumb').length){



        $('.productImageThumb').click(function(){



            $('.productImageMax').fadeOut('fast').attr('src', $(this).attr('href')).fadeIn('fast');



            return false;



        });



    }







    if($('#CategoryId').length){



        $('#CategoryId').change(function(){



            document.location = '/categories/view/' + $('#CategoryId option:selected').attr('value');



        });



    }







    if($('#myselectbox').length){



        $('#myselectbox').change(function(){



            document.location = '/categories/view/' + $('#myselectbox option:selected').attr('value');



        });



    }



});



  function  timeExam()

      {//alert("time")
if(document.getElementById("contentArea"))
{
		$.ajax({
		
		url : "/time.php",
		
		success : function (data) {
		//alert(data);alert(document.getElementById("contentArea").innerHTML);
		//$("#contentArea").html(data);
		document.getElementById("contentArea").innerHTML=data;
		
		}
		
		});
}

//setTimeout("timeExam()", 1000);

      }
	  
//************Remove Spaces functions***************8	
String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
}
String.prototype.ltrim = function() {
	return this.replace(/^\s+/,"");
}
String.prototype.rtrim = function() {
	return this.replace(/\s+$/,"");
}


function frmbidbutlersubmit(id,sprc){
//alert("hi")
       // var auctionElement = 'auction_' + $(this).attr('title');
		var minprc=document.getElementById("BidbutlerMinimumPrice");
		var maxprc=document.getElementById("BidbutlerMaximumPrice");
		var bids=document.getElementById("BidbutlerBids");
		var flag=true;
		var err=ValidatePrice(minprc.value);
		if(err!="")
		{
		   var name=confirm(err)
		  if(name==true)location.href='/auctions/view/'+id;

		  flag=false;
		  minprc.focus();
		 return false;	
		}
		err=ValidatePrice(maxprc.value);
		if(err!="")
		{
		 // alert(err);
		  var name=confirm(err)
		  if(name==true)location.href='/auctions/view/'+id;
		   flag=false;
		   maxprc.focus();
		 	return false;	
		}
		err=ValidateNumeric(bids.value);
		if(err!="")
		{
		   var name=confirm(err)
		  if(name==true)location.href='/auctions/view/'+id;

		   flag=false;
		   bids.focus();
		 return false;	
		}
		
		/*if(sprc>minprc.value)
		{
		 alert("The Minimum price should be higher then auction price");	
		 return false;	
		}
		if(sprc>maxprc.value)
		{
		 alert("The Maximum price should be higher then auction price");	
		 return false;	
		}
		if(minprc.value>maxprc.value)
		{
		 alert("The Maximum price should be higher then minimum price");	
		 return false;	
		}
*/		var urlnew='/bidbutler.php?id='+id +"&minprc="+minprc.value+"&maxprc="+maxprc.value+"&bids="+bids.value
	
        //auctionObjects[auctionElement]['bidbutler-button'].hide(1);
       // auctionObjects[auctionElement]['bid-loading'].show(1);
		//alert(urlnew)
		if(flag==true)
		{
        	$.ajax({



            url:urlnew,



            dataType: 'json',



            success: function(data){//alert("hi")

				//alert(data.Auction.message)
				var str=data.Auction.message.trim();
				//alert(str)
				var strsuccess=data.Auction.succes.trim();
				//alert(strsuccess)
				var name=confirm(str)
				if(name==true)location.href='/auctions/view/'+data.Auction.id;
				


            }



        });





		}

        return false;
		


    }
	
	//*************function for validate username**************

	function ValidatePrice(strng)
	 {
			 var error = "";
			 if (strng.trim() == "") {
				error = "Please Enter Value.\n";
			 }
			 	 
			 if(error=="")
			 {
				 var ValidChars = ".0123456789";
				 var IsNumber=true;
				 var Char;
				 var str=strng;
				 var dot=".";
				 var lstr=str.length;
				 var ldot=str.indexOf(dot);
				 for (i = 0; i < str.length && IsNumber == true; i++) 
				 { 
							Char = str.charAt(i); 
							if (ValidChars.indexOf(Char) == -1) 
							{
								error="Please enter a value in Pounds only";
							}//end if
				 }//end for
			}			
			
			return error;
	}
	
function ValidateNumeric(strng)
	 {
			 var error = "";
			 if (strng.trim() == "") {
				error = "Please Enter Value.\n";
			 }
			 	 
			 if(error=="")
			 {
				 var ValidChars = "0123456789";
				 var IsNumber=true;
				 var Char;
				 var str=strng;
				 var dot=".";
				 var lstr=str.length;
				 var ldot=str.indexOf(dot);
				 for (i = 0; i < str.length && IsNumber == true; i++) 
				 { 
							Char = str.charAt(i); 
							if (ValidChars.indexOf(Char) == -1) 
							{
								error="Value Should  Numeric Value";
							}//end if
				 }//end for
			}			
			
			return error;
	}
function loginbox(obj)
{
		//alert("hi")
 		var paymentype;
		var val="";
 		for (var i = 0; i < document.packages.elements.length; i++) 
		  {
			var e = document.packages.elements[i];
			if ((e.name == 'Mer') && (e.type == 'radio')) 
			{
				if(e.checked)paymentype = e.value;
			}
			else
			{
				if(e.checked)val = e.value;
			}
		  }
		//  alert(paymentype); alert(val);
		  if(val=="")
		  {
			alert("Please select any one package");  
			return false;
		   }
		   else
		   {
				if(paymentype=="paypal")var url="/payment_gateways/paypal/package/"+ val;
				if(paymentype=="moneybooker")var url="/payment_gateways/moneybooker/package/"+ val;
				document.packages.action=url;
				document.packages.submit();
				return false;
		   }
}
function loginboxauction(obj)
{
		var minprc=document.getElementById("paymentmethod").value;
		location.href=minprc;
 		
}

function goreward(url,points,bal)
{
		//var minprc=document.getElementById("paymentmethod").value;
		//location.href=minprc;
		//alert(eval(points))
		//alert(eval(bal))
		if(eval(points) >= eval(bal))
		{
			alert("Oops! You don't have enough Reward Points for that just yet! Carry on saving them up Skill Shopper!");
			return false;
		}
		else
		{
			location.href=url;
		}
 		
}
function showhide(typ,shw)
{
	  if(typ=="ul")
	  {
		if(shw=="show")
		{
			$(".divcategories").show("fast");
			$(".divcategories").style.display="";
		}
		else
		{
			$(".divcategories").hide("fast");
			$(".Current_Live_Auc2").show("fast");
		}
	  }
	  
	   if(typ=="div")
	  {
		if(shw=="show")
		{
			$(".Current_Live_Auc2").hide("fast");
			//$(".categories").show("slow");
			//alert(document.getElementById("ulcat").style);
			document.getElementById("ulcat").style.display="block";
			document.getElementById("ulcat").style.display="";
			document.getElementById("ulcat").removeAttribute("style");
			
		}
		else
		{
			$(".divcategories").hide("fast");
			$(".Current_Live_Auc2").show("fast");
		}
	  }
}