

// Countdown stuff
 $(document).ready(function(){
	// Uncomment the line below if you ever want to 
	// use the countdown clock again
	//countdown(2011,3,15,0,0,1);
	preload("/images/btn_menu_light.gif",12,7);
	
	$(function(){
			$('#products').slides({
				preload: true,
				preloadImage: '/images/loading.gif',
				effect: 'fade',
				crossfade: true,
				slideSpeed: 200,
				fadeSpeed: 500,
				generateNextPrev: false,
				generatePagination: false,
				play: 3000
			});
		});
		
}); 


function toggle(on,off){
	off.style.display = "none";
	var el = document.getElementById(on);
	el.style.display = "block";
}
         
function countdown(year, month, day, hour, minute, format)
         {
         Today = new Date();
         Todays_Year = Today.getFullYear();
         Todays_Month = Today.getMonth();                  
         
         //Convert both today's date and the target date into miliseconds.                           
         Todays_Date = (new Date(Todays_Year, Todays_Month, Today.getDate(), 
                                 Today.getHours(), Today.getMinutes(), Today.getSeconds())).getTime();                                 
         Target_Date = (new Date(year, month - 1, day, hour, minute, 00)).getTime();                  
         
         //Find their difference, and convert that into seconds.                  
         Time_Left = Math.round((Target_Date - Todays_Date) / 1000);
         
         if(Time_Left < 0){
            Time_Left = 0;
         }
         
         switch(format)
               {
               case 0:
                    //The simplest way to display the time left.                     
                    document.getElementById('countdown').innerHTML = Time_Left + ' seconds';
                    break;
               case 1:
                    //More datailed.
                    days = Math.floor(Time_Left / (60 * 60 * 24));
                    Time_Left %= (60 * 60 * 24);
                    hours = Math.floor(Time_Left / (60 * 60));
                    Time_Left %= (60 * 60);
                    minutes = Math.floor(Time_Left / 60);
                    Time_Left %= 60;
                    seconds = Time_Left;
                    
                    dps = 's'; hps = 's'; mps = 's'; sps = 's';
                    //ps is short for plural suffix.
                    if(days == 1) dps ='';
                    if(hours == 1) hps ='';
                    if(minutes == 1) mps ='';
                    if(seconds == 1) sps ='';
                    
                    document.getElementById('countdown').innerHTML = '<div>' + days + ' day' + dps +  ',</div>';
                    document.getElementById('countdown').innerHTML +='<div>' + hours + ' hour' + hps + ',</div>';
                    document.getElementById('countdown').innerHTML +='<div>' + minutes + 'min' +  ',</div>';
                    document.getElementById('countdown').innerHTML +='<div id="seconds">' + seconds + 'sec' + '</div>';
                    break;
               default: 
                    document.getElementById('countdown').innerHTML = Time_Left + ' seconds';
               }
               
         //Recursive call, keeps the clock ticking.
         setTimeout('countdown(' + year + ',' + month + ',' + day + ',' + hour + ',' + minute + ',' + format + ');', 1000);
         }


// Preload some images
function preload(source,w,h){
	pic = new Image(w,h); 
	pic.src=source;
}

function clearField(field,txt){
	if(field.value == txt){
		field.value = "";
		field.setAttribute("class", "dark");
		if(field.type == 'textarea'){
			//field.setAttribute("rows", "5");		
		}
	}
}
  
function checkField(field,txt){
	if(field.value == ""){
		field.value = txt;
		field.setAttribute("class", "light");
		if(field.type == 'textarea' && collapse==true){
			//field.setAttribute("rows", "1");		
		}
	}
}

