function date(){
	var currentTime = new Date()
	var year = currentTime.getFullYear()
	document.write(year)
}

$(document).ready(function(){

	$("div#expandproducts").click(function() {
		$("div#expandproducts a").toggle();
		$("div#products").slideToggle();
	});

	$("div#expandrentals").click(function() {
		$("div#expandrentals a").toggle();
		$("div#rentals").slideToggle("slow");
	});

});

function validateForm(txtName,txtCompany,txtPhone,txtEmail) {
	
	var error=true;
	var errorMsg="";
        
    //validate name	  
	var trimmed = txtName.value.replace(/^\s+|\s+$/g, '') ;
    if (trimmed == "") {
        txtName.focus();
        errorMsg="Name field is empty.\n";
        error=false;
    }
    
    //validate company
	var trimmed = txtCompany.value.replace(/^\s+|\s+$/g, '') ;
    if (trimmed == "") {
        if(error==true){
           txtCompany.focus();
        }
        errorMsg=errorMsg+"Company field is empty.\n";
        error=false;
    }
    
    //validate txtPhone
	var trimmed = txtPhone.value.replace(/^\s+|\s+$/g, '') ;
    if (trimmed == "") {
        if(error==true){
           txtPhone.focus();
        }
        errorMsg=errorMsg+"Phone Number field is empty.\n";
        error=false;
    }
    
	//validate email
	var str = txtEmail.value; // email string
    
	var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid
	var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid
	if (!reg1.test(str) && reg2.test(str)) { // if syntax is valid
		
	}
	else{
        if(error==true){
           txtEmail.focus();
        }
	errorMsg=errorMsg+"Incorrect email.\n";
	error= false;
	}
  
	if(error==false)
	{
	   alert(errorMsg);
	   return error;
	}
	else
	{
	  return error;
	}
}

function setProduct(id)
{
	//set amount of sets
	var setAmount = 5;
	
	var i=1;
	for (i=1;i<=setAmount;i++)
	{
		var templinkid = "link"+i;
		document.getElementById(templinkid).className = "";
		var tempsetid = "set"+i;
		document.getElementById(tempsetid).className = "proddisplayoff";
	}
	
	var linkid = "link"+id;
	document.getElementById(linkid).className = "on";
	var setid = "set"+id;
	document.getElementById(setid).className = "";
	
	//set amount of products
	var productAmount = 15;
	
	var i=1;
	for (i=1;i<=productAmount;i++)
	{
		var tempheadid = "head"+i;
		document.getElementById(tempheadid).className = "";
		var tempcontentid = "content"+i;
		document.getElementById(tempcontentid).className = "proddisplaycontent";
	}
	
	var e=1;
	for (e=1;e<=productAmount;e=e+3)
	{
		var headid = "head"+e;
		document.getElementById(headid).className = "on";
		var contentid = "content"+e;
		document.getElementById(contentid).className = "proddisplaycontenton";
	}
	
}

function displayProduct(id)
{
	//set amount of products
	var productAmount = 15;
	
	var i=1;
	for (i=1;i<=productAmount;i++)
	{
		var tempheadid = "head"+i;
		document.getElementById(tempheadid).className = "";
		var tempcontentid = "content"+i;
		document.getElementById(tempcontentid).className = "proddisplaycontent";
	}
	
	var headid = "head"+id;
	document.getElementById(headid).className = "on";
	var contentid = "content"+id;
	document.getElementById(contentid).className = "proddisplaycontenton";
	
}
