// JavaScript Document
  function findPosX(obj)
  {
    var curleft = 0;
    if(obj.offsetParent)
        while(1) 
        {
          curleft += obj.offsetLeft;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.x)
        curleft += obj.x;
    return curleft;
  }


function loadFuncs(){



}

function checkEmail(proposed_email) {
var filter = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
if (!filter.test(proposed_email)) {
	return false;
} else {
	return true;
}
}


function signup_for_newsletter(proposed_email){
	if (checkEmail(proposed_email) ){
	new Ajax.Updater('email_signup_area','http://www.limelightlb.com/php/newsletter_signup.php', { parameters: { email: proposed_email }, method: 'post' });	
	}
}


function ask_question(question){

	new Ajax.Updater('faq_container','http://www.limelightlb.com/pages/faq.php', { parameters: { question : question }, method: 'post' });	

}


function load_change_form(object_id, object_type){
if( $F('field_to_change')  != '' ){
	new Ajax.Updater('request_change_area','http://www.limelightlb.com/php/changes_form.php', { parameters: { object_id:object_id, object_type: object_type, field_to_change: $F('field_to_change') }, method: 'post', evalScripts: true });
}
	}
	
function submit_changes_form(){
	var object_id = $F('object_id');
	var object_type = $F('object_type');
	var request_field_to_change = $F('field_to_change');
	var request_new_value_given = $F('request_new_value_given');
	var request_filed_by_name = $F('request_filed_by_name');
	var request_filed_by_email = $F('request_filed_by_email');
	var request_filed_by_ph_number = $F('request_filed_by_ph_number');
	
	new Ajax.Updater('request_change_area','http://www.limelightlb.com/php/changes_form.php', { parameters: {object_id:object_id, object_type:object_type,request_field_to_change:request_field_to_change, request_new_value_given: request_new_value_given, request_filed_by_name: request_filed_by_name, request_filed_by_email:request_filed_by_email,request_filed_by_ph_number:request_filed_by_ph_number}, method: 'post', evalScripts: true });
}	



function switch_menu(whichMenu){
	$('menu_what_to_do_in_long_beach_ca').style.backgroundColor='#8fce8a';
	$('menu_what_to_do_in_long_beach_ca').style.color='#FFFFFF';
	$('menu_places_to_be').style.backgroundColor='#8fce8a';
	$('menu_places_to_be').style.color='#FFFFFF';
	$('menu_guides').style.backgroundColor='#8fce8a';
	$('menu_guides').style.color='#FFFFFF';
	$('menu_about').style.backgroundColor='#8fce8a';
	$('menu_about').style.color='#FFFFFF';
	
	$(whichMenu).style.backgroundColor='#FFFFFF';
	$(whichMenu).style.color='#000000';
	  new Ajax.Updater('submenu', 'http://www.limelightlb.com/php/submenu.php', {
  parameters: { whichMenu: whichMenu }, method: 'post' });

}

function redo_calendar(timestamp,selected_date,selected_category,selected_tag,selected_cost,selected_timeframe,ongoing){
	  new Ajax.Updater('calendar', 'http://www.limelightlb.com/php/calendar.php', {
  parameters: { timestamp: timestamp, selected_date: selected_date, selected_tag: selected_tag, selected_category: selected_category, selected_cost: selected_cost, selected_timeframe : selected_timeframe, ongoing: ongoing }, method: 'post' });
}

function make_category_box(category,currently_selected_date,selected_cost,selected_timeframe,ongoing){
			$('arts_category_menu_point').style.display = 'none';
			$('business_category_menu_point').style.display = 'none';
			$('community_category_menu_point').style.display = 'none';
			$('nightlife_category_menu_point').style.display = 'none';
			$('neighborhoods_category_menu_point').style.display = 'none';
			$(category+'_category_menu_point').style.display = 'block';
			new Ajax.Updater('category_box_results', 'http://www.limelightlb.com/php/get_tags.php', {
  parameters: { category: category, currently_selected_date : currently_selected_date, selected_cost: selected_cost, selected_timeframe: selected_timeframe, ongoing: ongoing }, method: 'post' });
}

function load_category_box(){
	if($('inner_category_box').style.display=='none'){
	new Effect.BlindDown('inner_category_box', {  duration: 1.0 }) ;	
	
	} else {
	new Effect.BlindUp('inner_category_box', {  duration: 1.0 }) ;	
	}
}

function move_date_range(direction,whichDiv){
	if(direction == 'left'){	
	new Effect.Move(whichDiv, { x: 190, y: 0, mode: 'relative' }) ;
	} else {
	new Effect.Move(whichDiv, { x: -190, y: 0, mode: 'relative' }) ;	
	}
}


function recordAd(adid){

new Ajax.Updater( "adrecorder","http://www.limelightlb.com/php/recordAd.php", {
 	 method: 'post', parameters: { adid: adid}  });
	 
}
