$(document).ready(function(){


	//IMAGEFLOW
	var imageFlowCount = $('#imageflow_holder img').length;
	var instanceOne = new ImageFlow();
	instanceOne.init({ ImageFlowID:'imageflow_holder', captions: false, imageCursor: 'pointer', sliderCursor: 'pointer', imageFocusM: 1.0, reflectionGET: '&bgc=ffffff&fade_start=20%', opacity:true,  startID: Math.ceil(imageFlowCount/2)});

	if ($('body').attr('class') == "Portfolio") {
		var portfolio_showing = true;
	}//close if
	else {
		var portfolio_showing = false;
	}//close else

	if ($('body').attr('class') == "Services") {
		var services_showing = true;
	}//close if
	else {
		var services_showing = false;
	}//close else

	if ($('body').attr('class') == "About Us") {
		var about_showing = true;
	}//close if
	else {
		var about_showing = false;
	}//close else



	$('a#portfolio_slide_toggle').click(function() {
		if (portfolio_showing == false) {
				show_portfolio();
				portfolio_showing = true;
				if (services_showing == true) {
					hide_services();
					services_showing = false;
				}//close if
				if (about_showing == true) {
					hide_about();
					about_showing = false;
				}//close if
			}//close if
				else {
					hide_portfolio();				
					portfolio_showing = false;
				}//close else
		return false;
	});

	$('a#services_slide_toggle').click(function() {
		if (services_showing == false) {
				show_services();
				services_showing = true;
				if (portfolio_showing == true) {
					hide_portfolio();
					portfolio_showing = false;
				}//close if
				if (about_showing == true) {
					hide_about();
					about_showing = false;
				}//close if
			}//close if
				else {
					hide_services();			
					services_showing = false;	
				}//close else
		return false;
	});

	$('a#about_slide_toggle').click(function() {
		if (about_showing == false) {
				show_about();
				about_showing = true;
				if (portfolio_showing == true) {
					hide_portfolio();
					portfolio_showing = false;
				}//close if
				if (services_showing == true) {
					hide_services();
					services_showing = false;
				}//close if
			}//close if
				else {
					hide_about();			
					about_showing = false;	
				}//close else
		return false;
	});


	//blur links
	$('a').click(function() {
		this.blur();
	});

	
	
});//close ready function

function hide_services() {
	$('ul#sub_nav_services').animate(
		{
				height: "0px",
				top: "163px"
		}, 500);//close animate	
		services_showing = false;	
}

function show_services() {
	$('ul#sub_nav_services').animate(
		{
				height: "64px",
				top: "103px"
		}, 500);//close animate	
		services_showing = true;	
}

function hide_portfolio() {
	$('ul#sub_nav_portfolio').animate(
		{
				height: "0px",
				top: "163px"
		}, 500);//close animate	
		portfolio_showing = false;	
}

function show_portfolio() {
	$('ul#sub_nav_portfolio').animate(
		{
				height: "64px",
				top: "99px"
		}, 500);//close animate	
		portfolio_showing = true;	
}

function hide_about() {
	$('ul#sub_nav_about').animate(
		{
				height: "0px",
				top: "163px"
		}, 500);//close animate	
		about_showing = false;	
}

function show_about() {
	$('ul#sub_nav_about').animate(
		{
				height: "64px",
				top: "99px"
		}, 500);//close animate	
		about_showing = true;	
}


function Qverify() {
	var themessage = "Please complete at least the following fields:\r\n";
	if (document.CSDquestionnaire.Name.value=="") {
	themessage = themessage + "Name\r\n";
	}
	if (document.CSDquestionnaire.Company.value=="") {
	themessage = themessage + "Company\r\n";
	}
	if (document.CSDquestionnaire.Email.value=="") {
	themessage = themessage + "E-mail\r\n";
	}
	if (document.CSDquestionnaire.Phone.value=="") {
	themessage = themessage + "Phone Number\r\n";
	}
	//alert if fields are empty and cancel form submit
	if (themessage == "Please complete at least the following fields:\r\n") {
	document.CSDquestionnaire.submit();
	}
	else {
	alert(themessage);
	return false;
   }
}
