function brandcore() {
	var brandcore_win = window.open('http://www.moveo.com/brandcore/index.html','brandcore','width=620,height=300,top=0,left=0,resizable,scrollbars');
	brandcore_win.focus();
}
function services() {
	var services_win = window.open('http://www.moveo.com/new/service_offering.html','services','width=760,height=400,top=0,left=0,resizable,scrollbars');
	services_win.focus();
}
function contact_us() {
	var errors = new Array();
	var f = document.getElementById('contact_form');
	if (f.first_name.value == '' || f.first_name.value == ' ' || f.last_name.value == '' || f.last_name.value == ' ') { errors.push('Please enter your both your first and last name.'); }
	if (f.opt_in.checked && (f.email.value == '' || f.email.value == ' ')) { errors.push('Please enter your email address if you want us to stay in touch with you.'); }
	if (f.email.value != f.email_2.value) { errors.push('Email addresses do not match. Please re-enter.'); }
	//if (f.comments.value == '' || f.comments.value == ' ') { errors.push('Please enter a message in the comments area provided.'); }
	
	if (errors.length > 0) {
		var error_alert = 'The following errors have been detected:' + "\n";
		for (var i=0;i<errors.length;i++) {
			error_alert += (i+1) + '. ' + errors[i] + "\n";
		}
		error_alert += 'Please correct and resubmit the form.';
		alert(error_alert);
	} else {
 	 	var wr='wf'+(12+3)+'data';
 	 	document.contact_form.Reference.value=wr;
		f.submit();
	}
}
function submit_rfp() {
	var errors = new Array();
	var f = document.getElementById('submit_rfp_form');
	if (f.first_name.value == '' || f.first_name.value == ' ' || f.last_name.value == '' || f.last_name.value == ' ') { errors.push('Please enter your both your first and last name.'); }
	if (f.email.value == '' || f.email.value == ' ') { errors.push('Please enter your email address if you want us to stay in touch with you.'); }
	if (f.email.value != f.email_2.value) { errors.push('Email addresses do not match. Please re-enter.'); }
	//if (f.comments.value == '' || f.comments.value == ' ') { errors.push('Please enter a message in the comments area provided.'); }
	
	if (errors.length > 0) {
		var error_alert = 'The following errors have been detected:' + "\n";
		for (var i=0;i<errors.length;i++) {
			error_alert += (i+1) + '. ' + errors[i] + "\n";
		}
		error_alert += 'Please correct and resubmit the form.';
		alert(error_alert);
	} else {
 	 	var wr='wf'+(12+3)+'data';
 	 	document.submit_rfp_form.Reference.value=wr;
		f.submit();
	}
}

function display(id,type) {
	document.getElementById(id).style.display=type;
}

var curr_toggle = '';
var curr_toggle_status = 'none';
function toggle(id) {
	var obj = document.getElementById(arguments[0]).parentNode.firstChild;
		
	if (curr_toggle == '') {
		display(id,'block');
		curr_toggle_status = 'block';
		obj.style.backgroundPosition = "0 -15px";
				
	} else if (curr_toggle != id) {
		display(curr_toggle,'none');
		display(id,'block');
		curr_toggle_status = 'block';
		obj.style.backgroundPosition = "0 -15px";
		document.getElementById(curr_toggle).parentNode.firstChild.style.backgroundPosition = "0 3px";
		
	} else if (curr_toggle == id) {
		if (curr_toggle_status == 'block') {
			display(curr_toggle,'none');
			curr_toggle_status = 'none';
			obj.style.backgroundPosition = "0 3px";
			
		} else {
			display(curr_toggle,'block');
			curr_toggle_status = 'block';
			obj.style.backgroundPosition = "0 -15px";
		}
	}
	curr_toggle = id;
}

function downloadFile(file_path) {
	var download_win = window.open(file_path,'download','width=600,height=400,top=0,left=0,resizable,scrollbars');
	download_win.focus();
}
function openPage(file_path) {
	var new_page_win = window.open(file_path,'new page','width=600,height=400,top=0,left=0,resizable,scrollbars');
	new_page_win.focus();
}










// -------------------- OPT-IN FORM
var optin_win_obj = null;
function showOptinForm(id,track_dir) {
	//document.getElementById("podcast_player").style.display = "none";
	//document.getElementById("podcast-image").style.display = "block";
	
	// GOOGLE TRACKING
	var loc = window.location.href;
	if (track_dir == '') { // if track directory isn't set then use the page filename
		var tmp = loc.split('/');
		var req_file = tmp[(tmp.length)-1];
		var qmarkIndex = req_file.indexOf('?');
		if (qmarkIndex > -1) { req_file = req_file.substr(0,qmarkIndex); }
		track_dir = req_file.substr(0,req_file.indexOf('.'));
		if (track_dir == 'index') { track_dir = 'home'; }
	}
	urchinTracker('/'+ site_focus + '/optin/' + track_dir + '_reveal_' + id);

	if (track_dir == 'home' && site_focus == 'b2b') { $('b2b_sub_banner').hide(); } //hide the Flash banner so it does not interfere with the dhtml form
	
	var optin_form = '';
	var ajax_params = 'cmd=form&form_id=' + id;
	var ajax_url = site_ajax_dir + 'site_optin.php';
	
	ajax_params += '&site_focus=' + site_focus + '&track_dir=' + track_dir;
	
	var win_height = 300;
	switch (id) {
	case 'ignite' :
		win_height = 390;
	break;
	}
	
	var ajax_opts = {method: 'post',
		postBody: ajax_params,
		onSuccess: function(ajax_resp) {
			optin_win_obj = new Window({id:id+'_win','show':true,className:"alphacube",destroyOnClose:true,width:540,height:win_height,minimizable: false,maximizable: false,closable: false,resizable: false,draggable: false,showEffectOptions: {duration:.5}});
			optin_win_obj.getContent().innerHTML = ajax_resp.responseText;
			optin_win_obj.setZIndex(9999);
			optin_win_obj.showCenter(true);
		}
	}

	new Ajax.Request(ajax_url,ajax_opts);
}


function cancelOptinForm(id) {
	// GOOGLE TRACKING
	var track_dir = document.getElementById('track_dir').value;
	urchinTracker('/'+ site_focus + '/optin/' + track_dir + '_cancel_' + id);
	
	optin_win_obj.close();
	optin_win_obj = null;
	
	 //it is now safe to show the Flash banner again
	if (track_dir == 'home' && site_focus == 'b2b') { $('b2b_sub_banner').show(); }
	
	//document.getElementById("podcast-image").style.display = "none";
	//document.getElementById("podcast_player").style.display = "block";
				
}

function submitOptinForm(id,js) {
	var on_submit = (js && js != '') ? false : true;

	$(id+'_optin_error').innerHTML = ''; // clear form error
	var optin_form_holder = optin_win_obj.getContent().innerHTML;

	var form_id = id + '_optin_form';
	var errors = [];
	// error check form
	switch (id) {
	case 'ignite' :
		var req_fields = [	{'id':'first_name','name':'First Name'},
							{'id':'last_name','name':'Last Name'},
							{'id':'title','name':'Title'},
							{'id':'company_name','name':'Company Name'},
							{'id':'email_1','name':'Email'}
						];
		req_fields.each(function(field) {
			if ($(field.id).value == '') { errors.push(field.name + ' was left empty.'); }
		});
		
		if (errors.length < 1) {
			if ($('email_1').value != $('email_2').value) { errors.push('Emails do not match.'); }
		}
		break;
	}
	

	
	if (errors.length < 1) {
		// GOOGLE TRACKING
		var track_dir = $('track_dir').value;
		urchinTracker('/'+ site_focus + '/optin/' + track_dir + '_submit_' + id);
		//optin_win_obj.getContent().innerHTML = '<h2>Thanks for signing up!</h2><ul class="buttons"><li class="first"><a href="javascript:cancelOptinForm(\'' + id + '_optin_form\');"><span>close</span></a></li></ul><input type="hidden" id="track_dir" name="track_dir" value="' + track_dir + '" />';
		
		var loc = window.location.href;
		var optin_redir = (loc.indexOf('?') > -1) ? loc + '&optin_thanks=' + id : loc + '?optin_thanks=' + id;
		$('optin_redir').value = optin_redir;
		if (on_submit) { return true; } else { document.forms[0].submit(); }
	} else {
		var error_string = 'The following errors were detected:' + "\n";
		errors.each(function(error,index) {
			error_string += (index+1) + '. ' + error + "\n";
		});
		error_string += 'Please fix and re-submit the form.';
		alert(error_string);
		new Effect.Shake(Windows.focusedWindow.getId());
		if (on_submit) { return false; }
	}
}



// -------------------- OPT-OUT FORM
var optout_win_obj = '';
function showOptoutForm(id,track_dir) {
	// GOOGLE TRACKING
	var loc = window.location.href;
	if (track_dir == '') { // if track directory isn't set then use the page filename
		var tmp = loc.split('/');
		var req_file = tmp[(tmp.length)-1];
		var qmarkIndex = req_file.indexOf('?');
		if (qmarkIndex > -1) { req_file = req_file.substr(0,qmarkIndex); }
		track_dir = req_file.substr(0,req_file.indexOf('.'));
		if (track_dir == 'index') { track_dir = 'home'; }
	}
	urchinTracker('/'+ site_focus + '/optout/' + track_dir + '_reveal_' + id);

	if (track_dir == 'home' && site_focus == 'b2b') { $('b2b_sub_banner').hide(); } //hide the Flash banner so it does not interfere with the dhtml form
	
	var optout_form = '';
	var ajax_params = 'cmd=form&form_id=' + id;
	var ajax_url = site_ajax_dir + 'site_optout.php';
	
	ajax_params += '&site_focus=' + site_focus + '&track_dir=' + track_dir;
	
	var win_height = 300;
	switch (id) {
	case 'ignite' :
		win_height = 350;
	break;
	}
	
	var ajax_opts = {method: 'post',
		postBody: ajax_params,
		onSuccess: function(ajax_resp) {
			optout_win_obj = new Window({id:id+'_win','show':true,className:"alphacube",destroyOnClose:true,width:540,height:win_height,minimizable: false,maximizable: false,closable: false,resizable: false,draggable: false,showEffectOptions: {duration:.5}});
			optout_win_obj.getContent().innerHTML = ajax_resp.responseText;
			optout_win_obj.setZIndex(9999);
			optout_win_obj.showCenter(true);
		}
	}

	new Ajax.Request(ajax_url,ajax_opts);
}


function cancelOptoutForm(id) {
	// GOOGLE TRACKING
	var track_dir = document.getElementById('track_dir').value;
	urchinTracker('/'+ site_focus + '/optout/' + track_dir + '_cancel_' + id);
	
	optout_win_obj.close();
	optout_win_obj = null;
	
	if (track_dir == 'home' && site_focus == 'b2b') { 
		$('b2b_sub_banner').show(); 
	} //it is now safe to show the Flash banner again

				
}

function submitOptoutForm(id) {
	$(id+'_optout_error').innerHTML = ''; // clear form error
	var optout_form_holder = optout_win_obj.getContent().innerHTML;
	var form_id = id + '_optout_form';
	var errors = [];
	// error check form
	switch (id) {
	case 'ignite' :
		var req_fields = [	
							{'id':'email_1','name':'Email'}
						];
		req_fields.each(function(field) {
			if ($(field.id).value == '') { errors.push(field.name + ' was left empty.'); }
		});
		
		break;
	}
	
	if (errors.length < 1) {
		// GOOGLE TRACKING
		var track_dir = $('track_dir').value;
		urchinTracker('/'+ site_focus + '/optout/' + track_dir + '_submit_' + id);
		//optout_win_obj.getContent().innerHTML = '<h2>Thanks for signing up!</h2><ul class="buttons"><li class="first"><a href="javascript:cancelOptoutForm(\'' + id + '_optout_form\');"><span>close</span></a></li></ul><input type="hidden" id="track_dir" name="track_dir" value="' + track_dir + '" />';
		
		var loc = window.location.href;
		var optout_redir = (loc.indexOf('?') > -1) ? loc + '&optout_thanks=' + id : loc + '?optout_thanks=' + id;
		$('optout_redir').value = optout_redir;
		return true;
	} else {
		var error_string = 'The following errors were detected:' + "\n";
		errors.each(function(error,index) {
			error_string += (index+1) + '. ' + error + "\n";
		});
		error_string += 'Please fix and re-submit the form.';
		alert(error_string);
		new Effect.Shake(Windows.focusedWindow.getId());
		return false;
	}
}




// -------------------- OPT-IN THANKS MESSAGE
var optinThanks_win_obj = '';
function showOptinThanks(id,track_dir) {
	// GOOGLE TRACKING
	var loc = window.location.href;
	if (track_dir == '') { // if track directory isn't set then use the page filename
		var tmp = loc.split('/');
		var req_file = tmp[(tmp.length)-1];
		var qmarkIndex = req_file.indexOf('?');
		if (qmarkIndex > -1) { req_file = req_file.substr(0,qmarkIndex); }
		track_dir = req_file.substr(0,req_file.indexOf('.'));
		if (track_dir == 'index') { track_dir = 'home'; }
	}
	//urchinTracker('/'+ site_focus + '/optinThanks/' + track_dir + '_reveal_' + id);

	if (track_dir == 'home' && site_focus == 'b2b') { $('b2b_sub_banner').hide(); } //hide the Flash banner so it does not interfere with the dhtml form

	var win_height = 300;
	
	optinThanks_win_obj = new Window({id:id+'_win','show':true,className:"alphacube",destroyOnClose:true,width:540,height:win_height,minimizable: false,maximizable: false,closable: false,resizable: false,draggable: false,showEffectOptions: {duration:.5}});
	optinThanks_win_obj.getContent().innerHTML = '<h2>Thanks for subscribing!</h2><a href="javascript:closeOptinThanks(\'' + id + '\',\'' + track_dir + '\');">close</a>';
	optinThanks_win_obj.setZIndex(9999);
	optinThanks_win_obj.showCenter(true);
}


function closeOptinThanks(id,track_dir) {
	// GOOGLE TRACKING
	var loc = window.location.href;
	//urchinTracker('/'+ site_focus + '/optinThanks/' + track_dir + '_cancel_' + id);	
	optinThanks_win_obj.close();
	optinThanks_win_obj = null;
	
	if (track_dir == 'home' && site_focus == 'b2b') { 
		$('b2b_sub_banner').show(); 
	} //it is now safe to show the Flash banner again

				
}






// -------------------- RESUME SUBMIT FORM
var resume_win_obj = '';
function showResumeForm(resume_type,job_id) {
	var win_height;
	var ajax_params = 'cmd=form&site_focus=' + site_focus + '&resume_type=' + resume_type + '&job_id=' + job_id;
	var ajax_url = site_ajax_dir + 'resume_submit.php';

	switch (resume_type) {
	case 'intern' :
		win_height = 420;
		break;
	case 'fulltime' :
		win_height = 270;
		break;
	}
	
	
	var ajax_opts = {method: 'post',
		postBody: ajax_params,
		onSuccess: function(ajax_resp) {
			resume_win_obj = new Window({id:'resume_win','show':true,className:"alphacube",destroyOnClose:true,width:540,height:win_height,minimizable: false,maximizable: false,closable: false,resizable: false,draggable: false,showEffectOptions: {duration:.5}});
			resume_win_obj.getContent().innerHTML = ajax_resp.responseText;
			resume_win_obj.setZIndex(9999);
			resume_win_obj.showCenter(true);
		}
	}
	
	new Ajax.Request(ajax_url,ajax_opts);
}

function cancelResumeForm() {
	resume_win_obj.close();
	resume_win_obj = null;
}

function submitResumeForm() {
	var resume_form_holder = resume_win_obj.getContent().innerHTML;
	var form_id = 'resume_form';
	
	// error check form
	var res_file = $('resume_file').value;
	var res_copy = $('resume_copy').value;
	var valid_form = new FormValidator(form_id,'form');
	valid_form.compare('email_1','email_2','emails');
	if (res_file == '' && res_copy == '' ) {
		valid_form.add_error('You must either paste your resume in the space provided or upload one.');
	}
	
	if (valid_form.validate()) {
		$('resume_form').submit();
	} else {
		new Effect.Shake(Windows.focusedWindow.getId());
		valid_form.report_errors();
	}
}

function resumeSubmitted () {
	resume_win_obj = new Window({id:'resume_win','show':true,className:"alphacube",destroyOnClose:true,width:540,height:200,minimizable: false,maximizable: false,closable: false,resizable: false,draggable: false,showEffectOptions: {duration:.5}});
	resume_win_obj.getContent().innerHTML = '<h2>Thanks for your interest in Mov&eacute;o!</h2><ul class="buttons"><li class="first"><a href="javascript:cancelResumeForm();"><span>close</span></a></li></ul>';
	resume_win_obj.setZIndex(9999);
	resume_win_obj.showCenter(true);
}

function heardAbout () {
	if (document.getElementById('heard_about').value == "Other") {
		document.getElementById('heard_about_other').style.display = 'block';
	} else {
		document.getElementById('heard_about_other').style.display = 'none';
	}
}
