$(document).ready(function() {
	$("#contactUsBttn").click(function() {
		$("#contact").slideToggle("slow");
	});
});

/*
$(window).load(function() {
	$('#slider').nivoSlider({
		effect:'fold', //Specify sets like: 'fold,fade,sliceDown'
		slices:15,
		animSpeed:500,
		pauseTime:8000,
		startSlide:0, //Set starting Slide (0 index)
		directionNav:true, //Next & Prev
		directionNavHide:true, //Only show on hover
		controlNav:true, //1,2,3...
		controlNavThumbs:false, //Use thumbnails for Control Nav
    controlNavThumbsFromRel:false, //Use image rel for thumbs
		controlNavThumbsSearch: '.jpg', //Replace this with...
		controlNavThumbsReplace: '_thumb.jpg', //...this in thumb Image src
		keyboardNav:true, //Use left & right arrows
		pauseOnHover:false, //Stop animation while hovering
		manualAdvance:false, //Force manual transitions
		captionOpacity:0.8, //Universal caption opacity
		beforeChange: function(){},
		afterChange: function(){},
		slideshowEnd: function(){} //Triggers after all slides have been shown
	});
});
*/

function setBgImage()
{
	w=screen.width;
	h=screen.height;
	if ((w<=1280) && (h<=800))
	{
		document.body.style.backgroundImage="url(atr_sitebg_1280.jpg)";
	}
	else
	if ((w<=1440) && (h<=900))
	{
		document.body.style.backgroundImage="url(atr_sitebg_1440.jpg)";
	}
	else
	if ((w<=1680) && (h<=1050))
	{
		document.body.style.backgroundImage="url(atr_sitebg_1680.jpg)";
	}
	else
	if ((w<=1920) && (h<=1200))
	{
		document.body.style.backgroundImage="url(atr_sitebg_1920.jpg)";
	}
	else
	{
		document.body.style.backgroundImage="url(atr_sitebg_2560.jpg)";
	}
}


function isValidEmail(email)
{
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   if(reg.test(email)==false)
	 {
      return false;
   }
	 else
	 {
		 return true;
	 }
}


function doContactUs()
{
  if	(
      (document.cuForm.cuName.value=='') ||
			(document.cuForm.cuCompany.value=='') ||
			(document.cuForm.cuEmail.value=='') ||
			(document.cuForm.cuPhone.value=='') ||
			(document.cuForm.cuInquiry.value=='')
    ) 
  {
    alert("Please enter your name, company, email, phone and inquiry.");
  }
	else
  if	 (isValidEmail(document.cuForm.cuEmail.value)==false)
  {
    alert('It appears that the email address you entered is not a valid email.');
  }
  else
  {
		alert("Thank you. After clicking OK, your request will be submitted. We'll respond as soon as possible.");
		document.cuForm.submit();
  }
}


function simClick(elementID)
{
	if($.browser.msie) //jQuery
	{
		//IE
		document.getElementById(elementID).click();
	}
	else
	{
		//non IE
		var evt = document.createEvent("MouseEvents");
		evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
		var cb = document.getElementById(elementID); 
		cb.dispatchEvent(evt);
	}
}

