function InsertFlashMovie(src, width, height)
{
  document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+ width +'" height="'+ height +'"><param name="wmode" value="transparent" /><param name="movie" value="'+src+'"><param name="quality" value="high"><EMBED SRC="'+src+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"  WIDTH="'+width+'" HEIGHT="'+height+'" WMODE="TRANSPARENT" MENU="FALSE" BGCOLOR="BLACK"></EMBED></object>');
}

//jquery
/*$(document).ready(function(){
	
	// Browse by Project type drop down
	$('#expand1').click(function(){
		$('#panel1').slideToggle('fast');
		$('#panel2').hide();
		$('#expand2').removeClass('active');
		$(this).toggleClass('active'); return false;
	});
	
	// Browse by Client type drop down
	$("#expand2").click(function(){
		$("#panel2").slideToggle("fast");
		$("#panel1").hide();
		$('#expand1').removeClass('active');
		$(this).toggleClass("active"); return false;
	});
	
	// See All Resources box
	$("#see_all").click(function(){
		$("#see_all_box").slideToggle("slow");
		$(this).toggleClass("active"); return false;
	});
	
	// Previews
	$("#left_arrow").hover(function() {
	  $(this).next("#preview1").animate({opacity: "show", top: "70"}, "slow");
	}, function() {
	  $(this).next("#preview1").animate({opacity: "hide", top: "80"}, "fast");
	});
	
	$("#right_arrow").hover(function() {
	  $(this).next("#preview2").animate({opacity: "show", top: "70"}, "slow");
	}, function() {
	  $(this).next("#preview2").animate({opacity: "hide", top: "80"}, "fast");
	});
		
});*/

//Form Validation
function validate_contact_form() {
	
	errors = 0;
	first_name = document.getElementById("first_name").value;
	last_name = document.getElementById("last_name").value;
	email = document.getElementById("email").value;
	
	hideAllErrors();
	
	
    if (email == "") {    	
        document.getElementById("email_error").style.display = "block"
        document.getElementById("email").focus();
        errors = 1;
    }
    
	if((email != "") && (!IsEmail(email))){					
	  	document.getElementById("email_invalid").style.display = "block";
	  	document.getElementById("email").focus();	  	
	  	errors = 1;				  	  		  	
	}
	
    
    if (first_name == "") {
        document.getElementById("first_name_error").style.display = "block";
        document.getElementById("first_name").focus();
        errors = 1;
    }
    
    if (last_name == "") {
        document.getElementById("last_name_error").style.display = "block";
        document.getElementById("last_name").focus();
        errors = 1;
    }
    
	if(errors == 0){
		document.contact_form.submit();
	}
}

function hideAllErrors() {
    document.getElementById("first_name_error").style.display = "none";
    document.getElementById("last_name_error").style.display = "none";
    document.getElementById("email_error").style.display = "none";
    document.getElementById("email_invalid").style.display = "none";
}

//Email Validator
function IsEmail(str) {
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	
	if (str.indexOf(at)==-1){
	   return false
	}
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	   return false
	}
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
	    return false
	}
	if (str.indexOf(at,(lat+1))!=-1){
	    return false
	}
	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
	    return false
	}
	if (str.indexOf(dot,(lat+2))==-1){
	    return false
	}
	if (str.indexOf(" ")!=-1){
	    return false
	}
	return true
}
