	var currentSlide = 1;
	var slideCount = 0;

	var curhSlide = 1;
	var hslideCount = 4;

	$(document).ready(function()
	{
		homeSlideShow();
	
		slideCount = $('.SlideShowDiv').length;
		
		if (slideCount > 0)
			setTimeout("executeSlideShow()",2050);
	});
	
	function submit_Next(vContType){
		$('#con_type').val(vContType);
		$('#f_next').submit();
	}

	function executeSlideShow()
	{	
		$('#Slide'+currentSlide).fadeIn(1000);
		$('#Slide'+currentSlide).animate({opacity: 1.0}, 4000).fadeOut(1000);

		currentSlide = (currentSlide == slideCount) ? 1 : currentSlide + 1;
		
		setTimeout("executeSlideShow()",6050);
	}
	
	
	function homeSlideShow()
	{	
		$('#h_Slide'+curhSlide).fadeIn(1000);
		$('#h_Slide'+curhSlide).animate({opacity: 1.0}, 8000).fadeOut(1000);

		curhSlide = (curhSlide == hslideCount) ? 1 : curhSlide + 1;
		
		setTimeout("homeSlideShow()",10050);
	}
	
	
	/* -------------------------------------------------------------------------
		Javascript Resize functions
	------------------------------------------------------------------------- */
	function resize()
	{
		var windowHeight=0;
		if (typeof(window.innerHeight)=='number') 
			windowHeight=window.innerHeight;
		else {
			if (document.documentElement && document.documentElement.clientHeight) 
				windowHeight=document.documentElement.clientHeight;
			else {
				if (document.body&&document.body.clientHeight) {
					windowHeight=document.body.clientHeight;
				}
			}
		}
	
		var minHeight = windowHeight - 650;
		$("#").style("height:" + minHeight);
	}	
	
	function FinalResize(size)
	{
		var divheight = document.getElementById("frame1");
		var newh = size - 208;  //100 for the height of the div, and some slack for the borders.
		var final = newh + "px"; //change the number to the a string
	
		divheight.style.height = final; //change the div height to the appropriate height.	
	}
	
	/* Form Validation */
	var BadColor = '#F00';
	var GoodColor = '#666';
	
	var FailedArray = new Array();

	function checkStrings(arUID){
		var returnVal = true;
		for (i = 0; i < arUID.length; i++){
			if ($('#' + arUID[i]).val() == ''){
				$('#lbl' + arUID[i]).css('color', BadColor);
				FailedArray.push(arUID[i]);
				returnVal = false;
			}
			else
				$('#lbl' + arUID[i]).css('color', GoodColor);
				
		}
		return returnVal;
	}
	
	function checkNumber(UID){
		var returnVal = true;
		if ($('#' + UID).val().length < 10){
			$('#lbl' + UID).css('color', BadColor);
			returnVal = false;
		}
		else
			$('#lbl' + UID).css('color', GoodColor);
			
		return returnVal;
	}
	
	function validateEmail(email)
	{
		var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,4}$/;
		return emailPattern.test(email);
	}
	
	function checkEmails(arEmail){
		returnVal = true;

		/* if two emails, check that they match */
		if (arEmail.length == 2 && $('#' + arEmail[0]).val() != $('#' + arEmail[1]).val())
			returnVal = false;
		/* Check email format */
		else if (returnVal && !validateEmail($('#' + arEmail[0]).val()))
			returnVal = false;
		
		if (!returnVal)
			$('.lblemail').css('color', BadColor);
		
		return returnVal;
	}

	function checkInputs()
	{
		var returnVal = true;
		if (!checkNumber('phone'))
			returnVal = false;
		if (!checkStrings(['email','confirmemail','password','confirmpassword','phone','company']))
			returnVal = false;
		if (!checkEmails(['email','confirmemail']))
			returnVal = false;
				
		return returnVal;
	}
	
	function checkContactForm(){
		var returnVal = true;
		
		if (!checkNumber('phone'))
			returnVal = false;
		if (!checkStrings(['firstname','lastname','company','ContactProduct','ContactRequest']))
			returnVal = false;
		if (!checkEmails(['email']))
			returnVal = false;
		
		return returnVal;	
	}
