//Website Lib
function init(strFun) {
	site_config(); //Configures all the elements as needed, for instance: applys colorbox to any element needed
	
	var funcCall = strFun + "();";
	window[strFun]();
}

function site_config() {
	
	//The team modal diplayed when someone clicks on the team button
	$("#main_btn_team").colorbox({ html: '' +
								 '<div id="site_modal_team_holder"> '+
								 '<div class="g_team_member"><h2>Joe L.J. McMillen</h2><p>Partner <span>- Lead Visionary</span></p></div> '+
								 '<div class="g_team_member"><h2>Daniel Berninger</h2><p>Partner <span>- eMerging Technologies</span></p></div> '+
								 '<div class="g_team_member"><h2>Albert Sirvent</h2><p>Partner <span>- Latin American Growth</span></p></div> '+
								 '</div>'});
}


//-------------------------------------------------------------------
//------------------------ VIEWS CONTROLLERS ------------------------
//-------------------------------------------------------------------
function site_view_home() {}
function site_view_events() {}
function site_view_ibizplans() {}
function site_view_portfolio() {}
function site_view_testimonials() {}


//VIEW CONTROLLER FOR CONTACT
function site_view_contact() {
	
	function sendContactForm( ds ) {
        $.ajax({
            type: "GET",
			url: "./assets/bin/view_contact.php",
            data: ds,
			async: false,
            success: function(data, textStatus, XMLHttpRequest) { 
                $('#view_contact_content_right').html("<h2>Thank You</h2><p>Your contact has been sent</p>")
                .hide()
                .fadeIn(500, function() { });        
            },
			error: function(XMLHttpRequest, textStatus, errorThrown) {
				$('#view_contact_content_right').html("<h1>Unable to send form</h1><p>An error occured while sending the contact form, please contact us through email.</p><p><i>Thank You</i></p>")
				.hide()
				.fadeIn(500, function() { });
			}
        });
        return false;
    }
	
	//$("#contactform").click( function() { sendContactForm(); } )
	
	$("#contactform").validationEngine( {
        success : function() { 
			var dataString = 'name=' + $('#contactform_name').val() + '&email=' + $('#contactform_email').val() + '&phone=' + $('#contactform_phone').val() + '&reason=' + $("#contactform_reason :selected").text() + '&comment=' + $('#contactform_comment').val();
			
			$('#view_contact_content_right').html("<h2>Sending Form</h2><p>Please wait</p>")
                .hide()
                .fadeIn(300, function() { });  
			
			sendContactForm( dataString );  
		}
	});
	
}
