function togglenewsletter() {
	$('leftnav-newsletter').toggle();
}

function togglepointsofcontact(theContact) {
	$('leftnav-pointsofcontact' +theContact).toggle();
}

function showleftnavdescribe(nr) {
	$('leftnav-desc-'+nr).toggle();
}

function openWindow(myURL, DoubleClick, params, windowName){
//	var axel = Math.random()+"";
//	var a = Math.floor(axel * 1000000000);

	windowName = ((typeof(windowName) == 'undefined') || (params.length == 0)) ? 'newWindow' : windowName;
	if((typeof(params) == 'undefined') || (params.length == 0)){
		new_window = window.open(myURL, windowName);
	}else{
		new_window = window.open(myURL, windowName, params);
	}

//	if((typeof(DoubleClick) == 'undefined') || (DoubleClick.length == 0)){
//		new Image().src = 'http://fls.doubleclick.net/activityi;src=1605195;type=mb11s065;cat=event902;qty=1;cost=90.00;ord='+ a +'?';
//	}
//	else if(DoubleClick == 'pdf') {
//		new Image().src = 'http://fls.doubleclick.net/activityi;src=1605195;type=mb11s065;cat=event340;qty=1;cost=500.00;ord='+ a +'?'
//	}
//	else if(DoubleClick == 'video') {
//		new Image().src = 'http://fls.doubleclick.net/activityi;src=1605195;type=mb11s065;cat=event085;qty=1;cost=250.00;ord='+ a +'?'
//	}
	new_window.focus();
}

var scroll_1 = false;
var scroll_2 = false;
var scroll_3 = false;
var scroll_4 = false;
var scroll_5 = false;
var scroll_6 = false;

function showtooltip(thetip, thesubject) {
	var thispage = "industry"
	hidetooltip(thispage);
	$('tooltip'+thetip+'-'+thispage+'').className = 'tooltip-show'
	
	if(thetip==10) {
		if(thesubject==1) {
			$('answers'+thetip+'Subject').value = "Comment for George Borgh on Integrated Infrastructure Solutions";
		}
		if(thesubject==2) {
			$('answers'+thetip+'Subject').value = "Comment for John Pouland on Integrated Infrastructure Solutions";
		}
	}
	
	if(thetip==20) {
		if(thesubject==1) {
			$('answers'+thetip+'Subject').value = "Comment for George Borgh on Public Safety and Security";
		}
		if(thesubject==2) {
			$('answers'+thetip+'Subject').value = "Comment for John Pouland on Public Safety and Security";
		}
	}
	
	if(thetip==30) {
		if(thesubject==1) {
			$('answers'+thetip+'Subject').value = "Comment for George Borgh on Energy and Environmental Solutions";
		}
		if(thesubject==2) {
			$('answers'+thetip+'Subject').value = "Comment for John Pouland on Energy and Environmental Solutions";
		}
	}
	
	if(thetip==40) {
		if(thesubject==1) {
			$('answers'+thetip+'Subject').value = "Comment for George Borgh on Public Health";
		}
		if(thesubject==2) {
			$('answers'+thetip+'Subject').value = "Comment for John Pouland on Public Health";
		}
	}
	
	if(thetip==50) {
		if(thesubject==1) {
			$('answers'+thetip+'Subject').value = "Comment for George Borgh on Transportation";
		}
		if(thesubject==2) {
			$('answers'+thetip+'Subject').value = "Comment for John Pouland on Transportation";
		}
	}
	
	if(thetip==60) {
		if(thesubject==1) {
			$('answers'+thetip+'Subject').value = "Comment for George Borgh on Water and Wastewater Solutions";
		}
		if(thesubject==2) {
			$('answers'+thetip+'Subject').value = "Comment for John Pouland on Water and Wastewater Solutions";
		}
	}
	
	if(thetip==1 && scroll_1 == false) {
		Scroller.reset('scroll-1');
		scroll_1 = true;
	} else if (thetip==2 && scroll_2 == false) {
		Scroller.reset('scroll-2');
		scroll_2 = true;
	} else if (thetip==3 && scroll_3 == false) {
		Scroller.reset('scroll-3');
		scroll_3 = true;
	} else if (thetip==4 && scroll_4 == false) {
		Scroller.reset('scroll-4');
		scroll_4 = true;
	} else if (thetip==5 && scroll_5 == false) {
		Scroller.reset('scroll-5');
		scroll_5 = true;
	} else if (thetip==5 && scroll_5 == false) {
		Scroller.reset('scroll-5');
		scroll_5 = true;
	}
}

function hidetooltip(thepage) {
	for (var i = 1; i <= 6; i++) {
		$('tooltip'+i+'-'+thepage+'').className = 'tooltip-hide'
		$('tooltip'+i+'0-'+thepage+'').className = 'tooltip-hide'
	}
}

function sendnewsletter() {
//	var url = 'http://recp.mkt32.net/servlet/UserSignUp?f=55308&postMethod=HTML&m=0&j=MAS2&';
//	new Image().src = url + $('newsletterform').serialize();
//	$('showform').hide();
//	$('form-success').show();

//	var axel = Math.random()+"";
//	var a = Math.floor(axel * 1000000000);
//	new Image().src = 'http://fls.doubleclick.net/activityi;src=1605195;type=mb11s065;cat=event529;qty=1;cost=2000.00;ord='+ a +'?';
//-------------------------------------------------------------	
	$('showform').hide();
	$('form-success').show();
	
	//var axel = Math.random()+"";
	//var a = Math.floor(axel * 1000000000);
	//new Image().src = 'http://ad.doubleclick.net/activity;src=1605195;type=mb11s065;cat=event529;qty=1;cost=4000.00;ord='+ a +'?';
	AddLinkEvent('event5');
	s.tl(true,'o','opt-in:'+s.pageName);	
	var randomNumber = getRandomAuthCode()+ "";
	
	//var url = 'http://recp.mkt32.net/servlet/UserSignUp?f=55308&postMethod=HTML&m=0&j=MAS2&auth_code=' + randomNumber + '&info_environment=Yes&info_industry=Yes&info_life=Yes&optin_src=answers_campaign&' + $('newsletterform').serialize();
	var url = 'http://recp.mkt32.net/servlet/UserSignUp?f=55308&postMethod=HTML&m=0&j=MAS2&auth_code=' + randomNumber + '&info_environment=Yes&info_industry=Yes&info_life=Yes&optin_src=answersforamerica_campaign&' + $('newsletterform').serialize();
	url = url.replace(/^\s+|\s+$/g,"");
	new Image().src = url;

	return false; //no real form submit if javascript is activated
}

function sencontact(formID) {
	var url = '../../apps/feature_contact/feature_contact.php';

//	var axel = Math.random()+"";
//	var a = Math.floor(axel * 1000000000);
//	new Image().src = 'http://fls.doubleclick.net/activityi;src=1605195;type=mb11s065;cat=event591;qty=1;cost=1000.00;ord='+ a +'?';

	AddLinkEvent('event33');
	s.tl(true,'o','contactform:'+s.pageName+'|form_'+formID);

	if(formID==1) {
		new Ajax.Request(url, {
			method: 'post',
			parameters: $('myform_1').serialize(),
			onSuccess: function() {
				$('tt-answers10').replace('<p class="success">Your message has been sumitted!<p>');
			}
		});
	}
	if(formID==2) {
		new Ajax.Request(url, {
			method: 'post',
			parameters: $('myform_2').serialize(),
			onSuccess: function() {
				$('tt-answers20').replace('<p class="success">Your message has been sumitted!<p>');
			}
		});
	}
	if(formID==3) {
		new Ajax.Request(url, {
			method: 'post',
			parameters: $('myform_3').serialize(),
			onSuccess: function() {
				$('tt-answers30').replace('<p class="success">Your message has been sumitted!<p>');
			}
		});
	}
	if(formID==4) {
		new Ajax.Request(url, {
			method: 'post',
			parameters: $('myform_4').serialize(),
			onSuccess: function() {
				$('tt-answers40').replace('<p class="success">Your message has been sumitted!<p>');
			}
		});
	}
	if(formID==5) {
		new Ajax.Request(url, {
			method: 'post',
			parameters: $('myform_5').serialize(),
			onSuccess: function() {
				$('tt-answers50').replace('<p class="success">Your message has been sumitted!<p>');
			}
		});
	}
	if(formID==6) {
		new Ajax.Request(url, {
			method: 'post',
			parameters: $('myform_6').serialize(),
			onSuccess: function() {
				$('tt-answers60').replace('<p class="success">Your message has been sumitted!<p>');
			}
		});
	}
	if(formID==7) {
		new Ajax.Request(url, {
			method: 'post',
			parameters: $('myform_7').serialize(),
			onSuccess: function() {
//				alert('afsadf');
				$('myform_7').hide();
				$('pointsofcontact1-success').show();
			}
		});
	}
	if(formID==8) {
		new Ajax.Request(url, {
			method: 'post',
			parameters: $('myform_8').serialize(),
			onSuccess: function() {
				$('myform_8').hide();
				$('pointsofcontact2-success').show();
			}
		});
	}
	//alert('Your request has been sumitted!')

}

function getRandomAuthCode()
{
	var randomNumber = '';
	for(i = 0; i < 8; i++)
	{
		randomNumber += Math.floor(Math.random()*10);
	}
	return randomNumber;
}
