/*
|--------------------------------------------------------------------------
| Amedia Creative Community > Front-End > Core JavaScript Calls
|--------------------------------------------------------------------------
|
| @package		Amedia Creative
| @subpackage	Frontend Framework
| @company		Amedia Creative, Inc.
| @phone		310/651/8733
| @fax			310/388/1210
| @author		Joey Avino
| @email		joey@amediacreative.com 
| @link			http://www.amediacreative.com
| @copyright	2008 Amedia Creative, Inc.
| @requires 	mootools.1.2.js
|
*/

/*
|--------------------------------------------------------------------------
| Amedia Creative Community > Front-End > Dropdown
|--------------------------------------------------------------------------
|
*/

	/**
	* Dropdown Forms Function
	*
	* @name 	dropdown
	* @access 	public
	* @param 	var-type none
	* @return 	none
	* @author 	Joey Avino
	* @email	joey@amediacreative.com
	
	function dropdown(obj_from) {

		var select = $(obj_from);
		$(obj_from+'_label').set('text',select.options[select.selectedIndex].text);
		select.addEvent('change', function() {

			$(obj_from+'_label').set('text',select.options[select.selectedIndex].text);

		});

	}	*/


	/**
	* Call submit toggle for the search submit box
	*
	* @name 	call_search_submit
	* @access 	public
	* @param 	var-type none
	* @return 	none
	* @author 	Ever Barreto
	* @email	e.barreto@amediacreative.com
	*/
	function call_search_submit() {
		
		submit_toggle();
		
	}





/*
|--------------------------------------------------------------------------
| Amedia Creative Community > Front-End > Dynamic Lead
|--------------------------------------------------------------------------
|
*/

	/**
	* This function calls all javascript realted to the Dynamic Lead
	*
	* @name 	call_dynamic_lead
	* @access 	public
	* @param 	var-type none
	* @return 	none
	* @author 	Joey Avino
	* @email	joey@amediacreative.com
	*/
	function call_dynamic_lead() {

		/**
		* Amedia Creative Frontend Framework > Kiwcks
		*
		* @name 	call_accordion_fx_1
		* @access 	public
		* @param 	var-type none
		* @return 	none
		* @author 	Joey Avino
		* @email	joey@amediacreative.com
		*/	
		var options = {
	
			obj_id: '#kwicks',
			obj_class: '.kwick',
			obj_expand: '.expand',
			obj_compress: '.compress',
			event_start: 'mouseenter',
			event_end: 'mouseleave',
			transition: Fx.Transitions.Pow.easeOut,
			duration: 300
 
		}
 
		var kwick = new Kwick(options);

		/**
		* Amedia Creative Frontend Framework > DL Accordion
		*
		* @name 	call_accordion_fx_1
		* @access 	public
		* @param 	var-type none
		* @return 	none
		* @author 	Joey Avino
		* @email	joey@amediacreative.com
		*/	
		var options = {

			button: '.toggler',							// Class of the h3 element
			content: '.element',						// Class of the content
			link_tag: '.toggler a',						// Selector of the link inside the h3
			start_event: 'mouseenter',					// Start Rollover Event
			end_event: 'mouseleave',					// End rollover Event
			css_start: '.accordion_link_rollover',		// CSS classof start rollover event
			css_end: '.accordion_link_rollout',			// CSS class of end rollover event
			a_speed: 1000,								// Speed of rollover event
			r_speed: 250,								// Accordion speed
			a_transition: Fx.Transitions.Pow.easeOut,	// Transition of rollover event
			r_transition: Fx.Transitions.Pow.easeOut,	// Transition of accordion event
			wait_bool: false,							// Wait bool
			a_id: 'accordion',							// Acordion ID
			a_css_active: 'accordion_active',			// A link active class
			a_css_link: 'accordion_link',				// A link defaul class
			start_pos: 0								// Starting content, 0 index

		}

		var accordion_fx = new AccordionFx(options);

	}









/*
|--------------------------------------------------------------------------
| Amedia Creative Community > Front-End > Sponsors
|--------------------------------------------------------------------------
|
*/

	/**
	* Function to setup Sponsor Validation
	*
	* @name 	call_load_form_sponsor_apply
	* @access 	public
	* @param 	var-type none
	* @return 	none
	* @author 	Ever Barreto
	* @email	e.barreto@amediacreative.com
	*/ 
	function call_load_form_sponsor_apply() {

		/* in extensions/sponsor.community.fx.js */
		prepare_apply_form('sponsor_apply_form');
		load_form_sponsor_apply();

	}
	
	/**
	* Function to setup Sponsor Comment Validation
	*
	* @name 	call_load_form_comment_sponsor
	* @access 	public
	* @param 	var-type none
	* @return 	none
	* @author 	Ever Barreto
	* @email	e.barreto@amediacreative.com
	*/ 
	function call_load_form_comment_sponsor() {
		
		/* in extensions/sponsor.community.fx.js */
		load_form_comment_sponsor();
		
	}
	
	/**
	* Call Comment on Sponsor
	*
	* @name 	call_comment_sponsor
	* @access 	public
	* @param 	var-type none
	* @return 	none
	* @author 	Joey Avino
	* @email	joey@amediacreative.com
	*/ 
	function call_comment_sponsor() {

		display_lightbox('#comment_sponsor_form', '#lightbox_box_overlay', 100, .8);

	}




	/**
	* Function that show the sponsor detail
	*
	* @name 	show_detail
	* @access 	public
	* @param 	integer id_sponsor
	* @return 	none
	* @author 	Ever Barreto
	* @email	ever@amediacreative.com
	*/ 
	function show_detail(id_sponsor) {

		/// Joey will replace with Framework Fake Accordion.
		$('sponsor_' + id_sponsor + '_header').tween('display', ['block', 'none']);
		$('sponsor_' + id_sponsor + '_detail').tween('display', ['none', 'block']);

	}





	/**
	* Function that show the sponsor header
	*
	* @name 	show_header
	* @access 	public
	* @param 	integer id_sponsor
	* @return 	none
	* @author 	Ever Barreto
	* @email	ever@amediacreative.com
	*/ 
	function show_header(id_sponsor) {
	
		$('sponsor_' + id_sponsor + '_detail').tween('display', ['block', 'none']);
		$('sponsor_' + id_sponsor + '_header').tween('display', ['none', 'block']);	
	
	}








/*
|--------------------------------------------------------------------------
| Amedia Creative Community > Front-End > Gallery
|--------------------------------------------------------------------------
|
*/

	/**
	* Add Comment > Amedia Creative Frontend Framework > Forms
	*
	* @name 	call_add_gallery_form
	* @access 	public
	* @param 	var-type none
	* @return 	none
	* @author 	Joey Avino
	* @email	joey@amediacreative.com
	*/ 
	function call_add_gallery_form() {
		
		// in gallery.community.fx.js
		add_gallery_form();

	}

	/**
	* Add Comment > Amedia Creative Frontend Framework > Forms
	*
	* @name 	call_add_gallery
	* @access 	public
	* @param 	var-type none
	* @return 	none
	* @author 	Joey Avino
	* @email	joey@amediacreative.com
	*/ 
	function call_add_gallery() {

		display_lightbox('#add_gallery_form', '#lightbox_box_overlay', 100, .8);

	}

/*
|--------------------------------------------------------------------------
| Amedia Creative Community > Front-End > Comments
|--------------------------------------------------------------------------
|
*/

	/**
	* Add Comment > Amedia Creative Frontend Framework > Forms
	*
	* @name 	add_comment_form
	* @access 	public
	* @param 	var-type none
	* @return 	none
	* @author 	Joey Avino
	* @email	joey@amediacreative.com
	*/ 
	function add_comment_form() {

		var check_list = new Array();
			check_list[0] = '.val_min_len_3';

		var form = $('comment_form');
		return init_val(check_list, form);

	}
	
	/**
	* Update the comments container 
	*
	* @name 	update_comments_container
	* @access 	public
	* @param 	var-type none
	* @return 	none
	* @author 	Ever Daniel Barreto
	* @email	ever@amediacreative.com
	*/ 
	function update_comments_container(id, url_path, div_to_update) {
		
		var comments_req = new Request({
				url: url_path,
				method: 'post',
				data: "id=" + id,
				onSuccess: function(response) {
					
					$(div_to_update).set('html', response);
					
				}
		});
		comments_req.send();
		
	}









/*
|--------------------------------------------------------------------------
| Amedia Creative Community > Front-End > Events
|--------------------------------------------------------------------------
|
*/

	/**
	* Agree To Terms > Amedia Creative Frontend Framework > Forms
	*
	* @name 	call_agree_multiselect
	* @access 	public
	* @param 	var-type none
	* @return 	none
	* @author 	Ever Barreto
	* @email	ever@amediacreative.com
	*/ 
	function call_agree_multiselect() {

		var options = {

			mouse_event: 'click',
			button_item: '.check_object',
			check_class: '.multiselect_checkbox',
			left_selected_class: 'left_selected',
			mid_selected_class: 'mid_selected',
			right_selected_class: 'right_selected',
			default_check: 1,
			radio: true

		}

		var multi_container_id = 'agree_checkboxes';
		var multiselect = new Multiselect(multi_container_id, options);

	}





	/**
	* Function to add event validation to forms used in the Event Controller
	*
	* @name 	add_event_validation
	* @access 	public
	* @param 	var-type none
	* @return 	none
	* @author 	Ever Barreto
	* @email	ever@amediacreative.com
	*/ 
	function add_event_validation() {

		/* ----- Located in event.community.fx.js -------------- */
		call_event_validation();

	}

	/**
	* Call Posting Go Back Action
	*
	* @name 	call_posting_go_back_action
	* @access 	public
	* @param 	var-type none
	* @return 	none
	* @author 	Ever Barreto
	* @email	ever@amediacreative.com
	*/
	function call_posting_go_back_action() {

		/* ----- Located in event.community.fx.js -------------- */
		posting_go_back_action();

	}





	/**
	* Gallery Featured > Amedia Creative Frontend Framework > Coverflow
	*
	* @name 	call_gallery_coverflow
	* @access 	public
	* @param 	var-type none
	* @return 	none
	* @author 	Ever Barreto
	* @email	ever@amediacreative.com
	*/
	function call_gallery_coverflow() {

		var my_coverflow = { 
 
			start: function() { 
 
				var cf = new coverflow($('gallery_coverflow'), { 
 
					reflection: 0.45, 				// Changes the reflection of the coverflow. 0 for nohting. 
					height_ratio: 0.65, 			// Will move the controls down. 
					offset_y: 0, 					// Will move the images down/
					start_index: 1, 				// This controls which card the coverflow starts on. 
					interval: 3000, 				// This interval is for the play/stop command. 
					factor: 176, 					// A factor of 176 made my 400x300 images their actual size. 
					use_caption: true,				// Shows captions. 
					use_resize: true,				// Needs to match window resize. 
					use_slider: true,				// Will hide/show the slider. 
					use_window_resize: true,		// Will hide/show the fullscreen option. 
					use_mouse_wheel: true,			// Will allow you to use the mouse wheel. 
					use_key_input: true,			// Will allow you to use arrow keys to work the coverflow. 
					use_auto_play: false,			// Will hide/show the play/stop option. 
					onClickView: function(obj) {

						window.location.href=''+obj['href']+'';

					}
 
				}); 
			} 
		};

		window.addEvent('domready', my_coverflow.start); 
	}
	
	/**
	* Function load the lightbox to pay an event
	*
	* @name 	call_pay_event
	* @access 	public
	* @param 	var-type none
	* @return 	none
	* @author 	Bart Jedrychowski
	* @email	bart@amediacreative.com
	*/ 
	function call_pay_event() {

		display_lightbox('#pay_event_form', '#lightbox_box_overlay', 100, .8);
		$('event_paypal_form').addEvent('submit', function(e) {
			//e = new Event(e).stop();
			var event_id = $('event_number').get('value');
			var JSON = new Request({url: '/ajax/index/'+event_id}).send('ajax_method=count.paypal.click');
		});
	}

	/**
	* Function load the lightbox and new edit form (Dashboard)
	*
	* @name 	call_post_event
	* @access 	public
	* @param 	var-type none
	* @return 	none
	* @author 	Ever Daniel Barreto
	* @email	ever@amediacreative.com
	*/ 
	function call_post_event() {

		prepare_event_form('event_post_form');
		display_lightbox('#post_event_form', '#lightbox_box_overlay', 100, .8);

	}
	
	/**
	* Function to prepare the form for new events
	*
	* @name 	prepare_event_form
	* @param 	str formid
	* @return 	none
	* @author 	Ever Daniel Barreto
	* @email	ever@amediacreative.com
	*/ 
	function prepare_event_form(formid) {

		var form = $(formid);
		if (form) {

			if (form.getStyle('display') == 'none')
				form.setStyle('display','block');
				
		}

		var ajax_page = $('add_event_step1_ajax_page');
		if (ajax_page) ajax_page.dispose();
		
		ajax_page = $('add_event_step2_ajax_page');
		if (ajax_page) ajax_page.dispose();

	}
	
	/**
	* Call the load form for New event
	*
	* @name 	call_load_form_new_event
	* @access 	public
	* @param 	var-type none
	* @return 	none
	* @author 	Ever Barreto
	* @email	ever@amediacreative.com
	*/ 
	function call_load_form_new_event() {
		
		/* in event.community.js */
		load_form_new_event();
		
	}
	
	/**
	* Call the load form for New event
	*
	* @name 	call_load_form_edit_event
	* @access 	public
	* @param 	var-type none
	* @return 	none
	* @author 	Ever Barreto
	* @email	ever@amediacreative.com
	*/ 
	function call_load_form_edit_event() {
		
		/* in event.community.js */
		load_form_edit_event();
		
	}
	
	
	/**
	* Call the load form for Send to A Friend
	*
	* @name 	call_load_form_send_event
	* @access 	public
	* @param 	var-type none
	* @return 	none
	* @author 	Ever Barreto
	* @email	ever@amediacreative.com
	*/ 
	function call_load_form_send_event() {
		
		/* in event.community.js */
		load_form_send_event();
		
	}
	
	/**
	* Call the load form for Cancel Event
	*
	* @name 	call_load_form_cancel_event
	* @access 	public
	* @param 	var-type none
	* @return 	none
	* @author 	Ever Barreto
	* @email	ever@amediacreative.com
	*/ 
	function call_load_form_cancel_event() {
		
		/* in event.community.js */
		load_form_cancel_event();
		
	}
	
	


/*
|--------------------------------------------------------------------------
| Amedia Creative Community > Front-End > Top Five
|--------------------------------------------------------------------------
|
| NOTE: This function calls all javascript related to the the five
|		and is shared with Events, Articles, and Galliers.
|
*/

	/**
	* Top 5 Tabs > Amedia Creative Frontend Framework > Tabs
	*
	* @name 	call_tabs_top_5
	* @access 	public
	* @param 	var-type none
	* @return 	none
	* @author 	Ever Barreto
	* @email	ever@amediacreative.com
	*/
	var call_tabs_top_5 = function() {

		var options = {

			event: 'click',
			tab_menu_id: '#top_five_tabs',
			tab_class: '.tab_option',
			content_id: '#top_five_content',
			content_class: '.tab_top_five',
			default_tab: 0

		};
		
		var tabs = new Tabs(options);

	}





	/**
	* Top 5 Accordion > Amedia Creative Frontend Framework > Acordion
	*
	* @name 	call_accordion_top_5
	* @access 	public
	* @param 	var-type none
	* @return 	none
	* @author 	Joey Avino
	* @email	joey@amediacreative.com
	*/
	function call_accordion_top_5() {

		var options = {

			button: '.toggler',							// Class of the h3 element
			content: '.element',						// Class of the content
			link_tag: '.toggler a',						// Selector of the link inside the h3
			start_event: 'mouseenter',					// Start Rollover Event
			end_event: 'mouseleave',					// End rollover Event
			css_start: '.accordion_link_rollover',		// CSS classof start rollover event
			css_end: '.accordion_link_rollout',			// CSS class of end rollover event
			a_speed: 1000,								// Speed of rollover event
			r_speed: 250,								// Accordion speed
			a_transition: Fx.Transitions.Pow.easeOut,	// Transition of rollover event
			r_transition: Fx.Transitions.Pow.easeOut,	// Transition of accordion event
			wait_bool: false,							// Wait bool
			a_id: 'accordion',							// Acordion ID
			a_css_active: 'accordion_active',			// A link active class
			a_css_link: 'accordion_link',				// A link defaul class
			start_pos: 0								// Starting content, 0 index

		}

		var accordion_fx = new AccordionFx(options);

	}










/*
|--------------------------------------------------------------------------
| Amedia Creative Community > Front-End > Account
|--------------------------------------------------------------------------
|
*/

	/**
	* Dashboard Tabs > Amedia Creative Frontend Framework > Tabs
	*
	* @name 	call_account_tabs
	* @access 	public
	* @param 	var-type none
	* @return 	none
	* @author 	Joey Avino / Bart Jedrychowski
	* @email	joey@amediacreative.com / bart@amediacreative.com
	*/ 
	function call_account_tabs() {

		var options = {

			event: 'click',
			tab_menu_id: '#pagename_tab',
			tab_class: '.tab_option',
			content_id: '#pagename_content',
			content_class: '.tab_page',
			default_tab: 0

		};
		
		var tabs = new Tabs(options);

	}





	/**
	* Quick Login > Amedia Creative Frontend Framework > Forms
	*
	* @name 	call_quick_login
	* @access 	public
	* @param 	var-type none
	* @return 	none
	* @author 	Joey Avino / Bart Jedrychowski
	* @email	joey@amediacreative.com / bart@amediacreative.com
	*/ 
	function call_quick_login() {

		var check_list = new Array('.val_min_len_3');
		var form = $('quick_login_form');

		if (form) {

			init_val(check_list,form);
			submit_toggle();

		}

	}





	/**
	* Edit Account > Amedia Creative Frontend Framework > Forms
	*
	* @name 	edit_acount
	* @access 	public
	* @param 	var-type none
	* @return 	none
	* @author 	Joey Avino / Bart Jedrychowski
	* @email	joey@amediacreative.com / bart@amediacreative.com
	*/
	function edit_account() {

		var check_list = new Array();
			check_list[0] = '.val_min_len_3';
			check_list[1] = '.val_min_len_2';
			check_list[2] = '.val_min_len_4';
			check_list[3] = '.val_phone';
			check_list[4] = '.val_email';
			check_list[5] = '.val_url';
			check_list[6] = '.val_password_4';

		var form = $('edit_form');
		submit_toggle();
		return init_val(check_list,form);

	}










/*
|--------------------------------------------------------------------------
| Amedia Creative Community > Front-End > Account
|--------------------------------------------------------------------------
|
*/

	/**
	* Add Referral > Amedia Creative Frontend Framework > Forms
	*
	* @name 	call_add_referral
	* @access 	public
	* @param 	var-type none
	* @return 	none
	* @author 	Joey Avino / Bart Jedrychowski
	* @email	joey@amediacreative.com / bart@amediacreative.com
	*/
	function call_add_referral() {

		var check_list = new Array();
			check_list[0] = '.val_min_len_3';
			check_list[1] = '.val_min_len_10';
			check_list[2] = '.val_email';

		var form = $('referral_form');
		submit_toggle();
		return init_val(check_list,form);

	}










/*
|--------------------------------------------------------------------------
| Amedia Creative Community > Front-End > Gallery
|--------------------------------------------------------------------------
|
*/

	/**
	* This function calls the rotator on the gallery page.
	*
	* @name 	call_gallery_rotator
	* @access 	public
	* @param 	var-type none
	* @return 	none
	* @author 	Joey Avino
	* @email	joey@amediacreative.com
	*/
	var call_gallery_rotator = function() {

		var options = {

			slide_timer:  4000,
			transition_time: 2000,
			set_transition: Fx.Transitions.Pow.easeOut,
			slide_items: '.slide_item'

		}

		var rotator_id = 'items_container';
		var rotator = new Rotator(rotator_id, options);

	}





	/**
	* Function to call the carousel. Instantiates a carousel object by passing an options object to it.
	*
	*
	* @name 	call_gallery_view_carousel
	* @access 	public
	* @param 	var-type none
	* @return 	none
	* @author 	Joey Avino
	* @email	joey@amediacreative.com
	*/
	var call_gallery_view_carousel = function() { 

		var options = {

			item_width: 564,
			duration: 500,
			transition: Fx.Transitions.Pow.easeOut,
			next_btn_id: 'next_view', 
			prev_btn_id: 'prev_view',
			event: 'click'

		}

		var carousel_id = 'list_images_carousel';
		var carousel = new Carousel(carousel_id, options);

	}









/*
|--------------------------------------------------------------------------
| Amedia Creative Community > Front-End > Recently Viewed
|--------------------------------------------------------------------------
|
*/

	/**
	* Function to call the carousel. Instantiates a carousel object by passing an options object to it.
	*
	*
	* @name 	call_recent_carousel
	* @access 	public
	* @param 	var-type none
	* @return 	none
	* @author 	Ever Barreto
	* @email	ever@amediacreative.com
	*/
	var call_recent_carousel = function() { 

		var options = {
	
			item_width: 300,
			duration: 500,
			transition: Fx.Transitions.Pow.easeOut,
			next_btn_id: 'next_one', 
			prev_btn_id: 'prev_one',
			event: 'click'

		}
		
		var carousel_id = 'recent_carousel_container';
		var carousel = new Carousel(carousel_id, options);

	}










/*
|--------------------------------------------------------------------------
| Amedia Creative Community > Front-End > Articles
|--------------------------------------------------------------------------
|
*/

	/**
	* More By Carousel
	*
	*
	* @name 	call_moreby_carousel
	* @access 	public
	* @param 	var-type none
	* @return 	none
	* @author 	Joey Avino
	* @email	joey@amediacreative.com
	*/
	var call_moreby_carousel = function() { 

		var options = {

			item_width: 564,
			duration: 500,
			transition: Fx.Transitions.Pow.easeOut,
			next_btn_id: 'next_moreby', 
			prev_btn_id: 'prev_moreby',
			event: 'click'

		}

		var carousel_id = 'more_by_carousel_container';
		var carousel = new Carousel(carousel_id, options);

	}





	/**
	* Function load the lightbox and new article form.
	*
	* @name 	call_post_article
	* @access 	public
	* @param 	var-type none
	* @return 	none
	* @author 	Bart Jedrychowski
	* @email	bart@amediacreative.com
	*/ 
	function call_post_article() {

		prepare_form('article_form');
		display_lightbox('#add_article_form', '#lightbox_box_overlay', 100, .8);

	}
	
	/**
	* Function to load the lightbox and edit article form.
	*
	* @name 	call_edit_article
	* @access 	public
	* @param 	var-type none
	* @return 	none
	* @author 	Bart Jedrychowski
	* @email	bart@amediacreative.com
	*/ 
	function call_edit_article() {

		prepare_form('edit_article_form');
		display_lightbox('#edit_article_form', '#lightbox_box_overlay', 100, .8);

	}
	
	/**
	* Function to load the lightbox for send to a friend
	*
	* @name 	call_send_article
	* @access 	public
	* @param 	var-type none
	* @return 	none
	* @author 	Bart Jedrychowski
	* @email	bart@amediacreative.com
	*/ 
	function call_send_article() {

		display_lightbox('#send_article_form', '#lightbox_box_overlay', 100, .8);

	}










/*
|--------------------------------------------------------------------------
| Amedia Creative Community > Front-End > Messages
|--------------------------------------------------------------------------
|
*/

	/**
	* This function calls all javascript related to the Tabs in My Messages
	*
	* @name 	call_messagebox_tabs
	* @access 	public
	* @param 	var-type none
	* @return 	none
	* @author 	Ever Barreto
	* @email	ever@amediacreative.com
	*/
	var call_messagebox_tabs = function (default_sent) {

		/* ----- Call the second first of tabs. -------------- */
		var options = {

			event: 'click',
			tab_menu_id: '#messagebox_tabs',
			tab_class: '.tab_option',
			content_id: '#messagebox_tabs_content',
			content_class: '.tab_page',
			default_tab: default_sent

		};
		
		var tabs = new Tabs(options);

	}
	
	
	var pre_lightbox_selected;
	var temp_lightbox_tab;
	/**
	 * Displays a lightbox for a tab
	 *
	 * @param string _tab_id the id of the LI element of the lightbox tab
	 * @param the rest of the params are similar to display_lightbox
	 * @access 	public
	 * @return 	none
	 * @author 	Philip Ramirez
	 * @email	p.ramirez@amediacreative.com
	 */
	function display_lightbox_tab(_tab_id, _obj, _overlay, _duration, _opacity){
		temp_lightbox_tab = $$(_tab_id);
		pre_lightbox_selected = $$('li.selected');
		display_lightbox(_obj, _overlay, _duration, _opacity);
	}
	
	/**
	 * Hides a lightbox for a tab
	 *
	 * @param string _tab_id the id of the LI element of the lightbox tab
	 * @param the rest of the params are similar to close_lightbox
	 * @access 	public
	 * @return 	none
	 * @author 	Philip Ramirez
	 * @email	p.ramirez@amediacreative.com
	 */
	function close_lightbox_tab(_obj, _overlay, _duration, _opacity) {
		close_lightbox(_obj, _overlay, _duration, _opacity);
		
		temp_lightbox_tab.removeClass('selected');
		temp_lightbox_tab.getElement('a').removeClass('selected');
		
		pre_lightbox_selected.addClass('selected');
		pre_lightbox_selected.getElement('a').addClass('selected');
	}





	/**
	* Compose Message > Amedia Creative Frontend Framework > Forms
	*
	* @name 	call_messagebox_tabs
	* @access 	public
	* @param 	var-type none
	* @return 	none
	* @author 	Joey Avino
	* @email	joey@amediacreative.com
	*/
	function call_compose_message() {
		var check_list = new Array();
			check_list[0] = '.val_min_len_1';
			check_list[1] = '.val_min_len_3';

		var form = $('compose_message');
		submit_toggle();
		return init_val(check_list, form);

	}





/**
	* Compose Message > Amedia Creative Frontend Framework > Forms
	*
	* @name 	call_user_pm
	* @access 	public
	* @return 	void
	* @author 	Ever Barreto
	* @email	e.barreto@amediacreative.com
	*/
        function call_user_pm() {

            var check_list = new Array();
                check_list[0] = '.val_min_len_1';
                check_list[1] = '.val_min_len_3';

            var form = $('pm_user_form');
            submit_toggle();
            return init_val(check_list, form);
            
        }





	/**
	* Message Reply > Amedia Creative Frontend Framework > Forms
	*
	* @name 	call_messagebox_tabs
	* @access 	public
	* @param 	var-type none
	* @return 	none
	* @author 	Joey Avino
	* @email	joey@amediacreative.com
	*/
	function call_message_reply() {

		var check_list = new Array();
			check_list[0] = '.val_min_len_1';

		var form = $('reply_to_message');
		submit_toggle();
		return init_val(check_list,form);

	}










/*
|--------------------------------------------------------------------------
| Amedia Creative Community > Front-End > Signup
|--------------------------------------------------------------------------
|
*/

	/**
	* To call signup step 1
	*
	* @name 	call_signup1
	* @access 	public
	* @param 	var-type none
	* @return 	none
	* @author 	Bart Jedrychowski
	* @email	bart@amediacreative.com
	*/
	function call_signup1() {

		dropdown("dropdown");

		var _default = 1;

		/* ----- Signup Step 1 START: Custom Conditional -------------- */
		$$('.multiselect_checkboxes').getChildren()[0].each(function(child,i) {
			if (child.checked)
				_default = i;
		});
		/* ----- Signup Step 1 END: Custom Conditional -------------- */

		/* ----- Signup Step 1 > Amedia Creative Frontend Framework > Mulitselect -------------- */
		var options = {

			mouse_event: 'click',
			button_item: '.check_object',
			check_class: '.multiselect_checkbox',
			left_selected_class: 'left_selected',
			mid_selected_class: 'mid_selected',
			right_selected_class: 'right_selected',
			default_check: _default,
			radio: true
		}

		var multi_container_id = 'tos_select';
		var multiselect = new Multiselect(multi_container_id, options);

		/* ----- Signup Step 1 > Amedia Creative Frontend Framework > Mulitselect for User Private Information -------------- */
		var options = {

			mouse_event: 'click',
			button_item: '.check_object_2',
			check_class: '.multiselect_checkbox_2',
			left_selected_class: 'left_selected',
			mid_selected_class: 'mid_selected',
			right_selected_class: 'right_selected',
			default_check: 0,
			radio: true

		}

		var hpi_container_id = 'hpi_select';
		var multiselect_1 = new Multiselect(hpi_container_id, options);

		/* ----- Signup Step 1 > Amedia Creative Frontend Framework > Forms -------------- */
		var check_list = new Array();
			check_list[0] = '.val_min_len_3';
			check_list[1] = '.val_phone';
			check_list[2] = '.val_email';
			check_list[3] = '.val_dropdown';
			check_list[4] = '.val_min_len_6';
			check_list[5] = '.val_password_4';

		var form = $('signup_form');

		submit_toggle();

		return init_val(check_list, form);

	}






	/**
	* Signup Step 2 > Amedia Creative Frontend Framework > Forms
	*
	* @name 	call_signup2
	* @access 	public
	* @param 	var-type none
	* @return 	none
	* @author 	Bart Jedrychowski
	* @email	bart@amediacreative.com
	*/
	function call_signup2() {

		var check_list = new Array();
			check_list[0] = '.val_min_len_3';
			check_list[1] = '.val_phone';
			check_list[2] = '.val_url';
			check_list[3] = '.val_min_len_2';

		var form = $('signup_2_form');

		return init_val(check_list,form);

		submit_toggle();
		
	}












/*
|--------------------------------------------------------------------------
| Amedia Creative Community > Front-End > Report Inappropiate Content
|--------------------------------------------------------------------------
|
*/

	/**
	* Get the Report Inappropiate Content Form
	*
	* @name 	call_report_get_form
	* @access 	public
	* @param 	var-type none
	* @return 	none
	* @author 	Ever Daniel Barreto
	* @email	e.barreto@amediacreative.com
	*/
	function call_report_get_form(object_id, object_name) {
		
		if ($('report_ajax_form')) $('report_ajax_form').dispose();
		var main_body = $('lightbox_box_overlay').getParent();
		var report_form_request = new Request({

			url: '/ajax',
			method: 'post',
			data: 'ajax_method=report.get.form&id=' + object_id + '&object=' + object_name,
			evalScripts: true,
			evalResponse: false,
			onComplete: function(response) {

				var ajax_lightbox = new Element('div', { 'id': 'report_ajax_form', 'html': response });
				main_body.grab(ajax_lightbox, 'top');
				call_report_form();
				display_lightbox('#report_content', '#lightbox_box_overlay', 100, .8);

			}
				
		});
		report_form_request.send();

	}






	/**
	* Call Report Inappropiate Content Form
	*
	* @name 	call_report_form
	* @access 	public
	* @param 	var-type none
	* @return 	none
	* @author 	Ever Daniel Barreto
	* @email	e.barreto@amediacreative.com
	*/
	function call_report_form() {

		var check_list = new Array();
			check_list[0] = '.val_dropdown';
			check_list[1] = '.val_min_len_2';

		dropdown('report_category');
		//dropdown('report_detail');
		
		var form = $('report_content_form');
		var callback = 'handle_report_form(obj)';
		init_val(check_list, form, callback);

		submit_toggle();
		
	}

	/**
	* Function to process Report Form
	*
	* @name 	handle_report_form
	* @param 	obj form
	* @return 	none
	* @author 	Ever Daniel Barreto
	* @email	e.barreto@amediacreative.com
	*/
	function handle_report_form(obj) {

		obj.set('send', { 

			onComplete: function(response) {
				var id_hide = obj.get('id');
	 			var id_show = 'report_ajax_page';

				$(id_hide).setStyle('display', 'none');

				var ajax_page = new Element('div', { 'id': id_show, 'html': response, 'class': 'global_input_wrapper' });
				ajax_page.inject(obj.getParent(), 'bottom');
				handle_report_edit(id_hide, id_show);
				submit_toggle();
			}
		
		});

		obj.send();
		
	}
	
	/**
	* Function to process report content - go back and edit.
	*
	* @name 	handle_report_edit
	* @param 	str id_hide
	* @param 	str id_show
	* @return 	none
	* @author 	Ever Daniel Barreto
	* @email	e.barreto@amediacreative.com
	*/ 
	function handle_report_edit(h, s) {

		var button = $('btn_report_goback');
		if (button) {

			button.addEvent('click', function() {
			
				$(s).dispose();
				$(h).setStyle('display', 'block');

			});
		
		}
	}
	
	function category_update_details() {
		var detail = $('report_detail');
		var category_value = $('report_category').get('value');
		if (category_value != null) {
			detail.options.length = null;
			details[category_value].each(function(item, index) {
				detail.options[index] = new Option(item, index);
			});
		};
	}











/*
|--------------------------------------------------------------------------
| Amedia Creative Community > Front-End > Custom Functions
|--------------------------------------------------------------------------
|
| NOTE: Calls tabs and tab related data.
|
*/

	/**
	* This function will take the element you pass, display it,
	* find other similar elemetns and hide them.
	* A simple accordion basically.
	*
	* @name 	display
	* @access 	public
	* @param 	var-type none
	* @return 	none
	* @author 	Joey Avino
	* @email	joey@amediacreative.com
	*/ 
	function display(obj) {

		obj = $(obj);
		_class = obj.get('class');
		div_obj = $$('.'+_class);

		div_obj.each(function(e) {

			e.setStyle('display', 'none')
	
		});

		obj.setStyle('display', 'block')

	}





	/**
	* This function will switch two divs.
	*
	* @name 	fswitch
	* @access 	public
	* @param 	var-type none
	* @return 	none
	* @author 	Joey Avino
	* @email	joey@amediacreative.com
	*/ 
	function fswitch() {

		var atag = $('quick_menu_login');
		var obj_hide = $('quick_menu');
		var obj_show = $('quick_inputs_wrapper');

		if (atag) {
			
			atag.addEvent('click', function() {
				  
				obj_hide.setStyle('display', 'none');
				obj_show.setStyle('display', 'block');

			});
			
		}

	}





	/**
	* Add a spinning background to a div
	*
	* @name    spin_div
	* @access  public
	* @param   string div_id
	* @return  none
	* @author  Ever Daniel Barreto
	* @email   ever@amediacreative.com
	*/
	function spin_div(div_id) {
		
		var container = $(div_id);
		positioning = 'top: ' + container.offsetTop + 'px; width: ' + container.offsetWidth + 'px; height: ' + container.offsetHeight + 'px; ';
		container.set('html', container.get('html') + '<div id="spinning_container" class="spinning_div" style="position: absolute; ' + positioning + '"></div>');
		
	}
	
	/**
	* Function called inline to open URL's in a new window.
	*
	* @name call_url
	* @access public
	* @param var-type none
	* @return none
	* @author Joey Avino
	* @email joey@amediacreative.com
	*/
	function call_url(url) {
		window.open(url);
	}


	/**
	* Function to hide flash messages.
	*
	* @name 	hide_flash_msg
	* @access 	public
	* @param 	var-type none
	* @return 	none
	* @author 	Bart Jedrychowski
	* @email	bart@amediacreative.com
	*/ 
	function hide_flash_msg(css_class) {
	
		$$(css_class).each(function(el) {
			var fx = new Fx.Tween(el,{
				onComplete: function(){ 
					el.setStyle('display','none');
				}
			});
		
			var close = el.getElements('p.close')[0];
			if (close) {
				close.addEvent('click', function(e) {
					e.stop();
					fx.start('opacity','0');
				});
			} 
		});
	}






	/**
	* Function to change the height of column one depending on content
	*
	*
	* @name 	Auto Column Height
	* @access 	public
	* @param 	var-type none
	* @return 	none
	* @authors 	Joey Avino
	* @email	joey@amediacreative.com
	*/
	function auto_column_height(column, wrapper) {

		/* --- This function requires the folllowing HTML code in the header of the web page -------------- */
		/*
			<script type="text/javascript">var ie = 0;</script>

			<!--[if IE]>
				<script type="text/javascript">ie = 1;</script>
			<![endif]-->
		*/

		var obj = $(column);
		var wrapper = $(wrapper);

		if (ie) {

			wrapper.setStyle('height', 'auto');
			obj.setStyle('height', 'auto');

			var obj_height = parseInt(wrapper.getStyle('height').replace('px', ''), 10);
			var cur_col = parseInt(obj.getStyle('height').replace('px', ''), 10) + 200;

			wrapper.setStyle('height', '100%');
			obj.setStyle('height', '100%');

			if (obj_height >= cur_col)
				obj.setStyle('height', obj_height + 'px');

		}

		else {

			var obj_height = wrapper.getStyle('height');
			var cur_col = obj.getStyle('height');

			obj_height = parseInt(obj_height.replace('px', ''), 10);
			cur_col = parseInt(cur_col.replace('px', ''), 10) + 200;

			if (obj_height >= cur_col)
				obj.setStyle('height', obj_height + 'px');

		}
	}





	/**
	* Function to activate links on and off.
	*
	* @name 	Activate Links
	* @access 	public
	* @param 	var-type none
	* @return 	none
	* @author 	Joey Avino
	* @email	joey@amediacreative.com
	*/
	function activate_links(link_class, css_active) {

		var link_class = $$(link_class);

		link_class.each(function(element) {

			element.addEvent('click', function() {

				remove_link_classes(link_class, css_active);				  
				this.addClass(css_active);	  

			});					  						 
		});
	}





	/**
	* Function to remove classe to li menu
	*
	* @name 	Remove Link Classes
	* @access 	public
	* @param 	var-type none
	* @return 	none
	* @author 	Joey Avino
	* @email	joey@amediacreative.com
	*/
	function remove_link_classes(link_class, css_active) {

		link_class.each(function(element) {

			element.removeClass(css_active);

		});
	}
	
	/**
	 * Function to delete messages from the user's inbox or outbox
	 *
	 * @name	Delete Inbox Message
	 * @access	Public
	 * @param	string url
	 * @param	element_id
	 * @return	none
	 * @author	Philip Ramirez
	 * @email	p.ramirez@amediacreative.com
	 */
	function delete_message(url, element_id) {
		var debug = true;
		if (!debug) {
			var el_request = new Request.JSON({url: url, onComplete: function(result) {hide_conversation(result);}}).get();
		} else {
			console.group('Function >> delete_message');
			console.log('url: '+url);
			console.log('element_id: '+element_id);
			console.groupEnd();
			result = new Object();
			result.conversation_deleted = true;
			hide_conversation(result);
		}
		
		function hide_conversation(result) {
			if (result.conversation_deleted) {
				console.log('conversation WAS deleted');
				var obj = $(element_id);
				var myFx = new Fx.Tween(obj, {duration: 500});
				myFx.start('opacity',1,0).chain(
					function(){ obj.setStyle('display', 'none'); this.callChain();},
					function(){ obj.dispose(); this.callChain(); },
					function(){
						var messages = $$('.message_details');
						if (messages == '') {
							$('empty_message_text').setStyle('display', 'block');
						}
					}
				);
			}
			if (debug) {
				console.group('Function >> hide_conversation');
				console.log('result: '+result);
				console.log('elem_id: '+element_id);
				console.groupEnd();
				console.log('obj: '+obj);
			}
		}
		return false;
	};
	
	/**
	* Compose Ticket > Amedia Creative Frontend Framework > Forms
	*
	* @name 	call_compose_ticket
	* @access 	public
	* @param 	var-type none
	* @return 	none
	* @author 	Philip Ramirez
	* @email	p.ramirez@amediacreative.com
	*/
	function call_compose_ticket() {
		var check_list = new Array();
			check_list[0] = '.val_min_len_1';
			check_list[1] = '.val_email';

		var form_id = 'compose_ticket';
		var form = $(form_id);
		submit_toggle();
		return init_val(check_list, form, 'ticket_form_submit(\''+form_id+'\')' );
	}
	
	function ticket_form_submit(form_id) {
//		var json = new Serializer('compose_ticket').json();
//		console.log(json);
/*		var form_object = $(form_id);
		form_object.set('send', {
			onComplete: function(response) {
				
				var id_hide = form_id;
	 			var id_show = 'send_article_ajax_response';
	
				fade(form_id);
	
				var ajax_page = new Element('div', {'id': id_show, 'html': response, 'class': 'global_input_wrapper' });
				ajax_page.inject(form_object.getParent(), 'top');
				article_send_edit(id_hide, id_show);
			});
		}*/
		fade_out(form_id, "fade_in('submit_message')");
	}
	
	/**
	 * Fades out, hides, and removes the passed element.
	 *
	 * @author	Philip Ramirez
	 * @return	void
	 */
	function fade_out(el_id, callback) {
		var obj = $(el_id);
		var myFx = new Fx.Tween(obj, {duration: 500});
		myFx.start('opacity',1,0).chain(
			function(){ obj.setStyle('display', 'none'); this.callChain();},
			function(){ obj.dispose(); this.callChain(); },
			function(){ if (callback != undefined) eval(callback); }
		);
	}
	
	/**
	 * Fades in the passed element.
	 *
	 * @author	Philip Ramirez
	 * @return	void
	 */
	function fade_in(el_id) {
		var obj = $(el_id);
		var myFx = new Fx.Tween(obj, {duration: 500});
		obj.setStyle('opacity', 0);
		obj.setStyle('display');
		myFx.start('opacity',0,1);
	}
	
	
	
	/**
 	 * form serialization)
 	 *
 	 * @notes STILL IN EARLY DEV
 	 * @author Philip Ramirez
 	 **/
	var Serializer = new Class({
		initialize: function(_form) {
			console.log('serializer started');
			this.form = $(_form);
			return this;
		},
		
	    makeArray: function( array ) {
            var ret = [];
            if (array != null) {
                var i = array.length;
                // The window, strings (and functions) also have 'length'
                if( i == null || typeof array === "string" || array.setInterval )
                    ret[0] = array;
                else
                	while(i)
                    	ret[--i] = array[i];
            }
            return ret;
	    },
	
		json: function() {
			var array = this.makeArray(this.form.elements).filter(function (el) {
//				console.log(el.name && !el.disabled && (el.checked || /select|textarea/i.test(el.nodeName) || /text|hidden|password/i.test(el.type)));
				return el.name && !el.disabled && (el.checked || /select|textarea/i.test(el.nodeName) || /text|hidden|password/i.test(el.type));
			}).map(function(el) {
				var val = $(el).get('value');
				return val == null ? null : {name: el.name, value: val};
			}).clean();
			return this.stringify(array);
		},
		
		stringify: function(json) {
			var ret = "{";
			if (json != null) {
				var len = json.length;
				for(var i=0; i<len-1; i++)
					ret += '"name":' + json[i].name + ',"value":' + json[i].value;
			}
			ret += '}';
			return ret;
		}
	});
