/* //////////////////////////////////

 main.js
 
 SEQOY Web Site 2.0 (seoqy.com)
 Main Javascript File
 
 Creation Date: May, 14. 2009
 Created by: SEQOY Development Team
 
 This file it's a open source Javascript file, 
 you can use this code as free as you want.


////////////////////////////////// */

//<![CDATA[
/* Replacement calls. Please see documentation for more information. */

if(typeof sIFR == "function"){


// Main sIFR Types
	sIFR.replaceElement(named({sSelector:"body h1", sFlashSrc:"/sifr/neosans.swf", sColor:"#777777", sHoverColor:"#b8b8b8", sWmode: "transparent", nPaddingTop:9 }));
	sIFR.replaceElement(named({sSelector:"body h2", sFlashSrc:"/sifr/neosans.swf", sColor:"#ffffff", sHoverColor:"#ffffff", sWmode: "transparent" }));
	sIFR.replaceElement(named({sSelector:"body h3", sFlashSrc:"/sifr/neosans.swf", sColor:"#222222" }));

// Follow Section Types
	sIFR.replaceElement(named({sSelector:"body follow_4", sFlashSrc:"/sifr/neosans.swf", sColor:"#FFA361", sHoverColor:"#FFBD61", nPaddingTop:9 }));
	sIFR.replaceElement(named({sSelector:"body follow_5", sFlashSrc:"/sifr/neosans.swf", sColor:"#8F70FF", sHoverColor:"#8F8BFF", nPaddingTop:9 }));
	sIFR.replaceElement(named({sSelector:"body follow_6", sFlashSrc:"/sifr/neosans.swf", sColor:"#FF4F61", sHoverColor:"#FF7961", nPaddingTop:9 }));
	sIFR.replaceElement(named({sSelector:"body follow_7", sFlashSrc:"/sifr/neosans.swf", sColor:"#63C6DC", sHoverColor:"#63D7F2", nPaddingTop:9 }));
	sIFR.replaceElement(named({sSelector:"body follow_8", sFlashSrc:"/sifr/neosans.swf", sColor:"#00B7DA", sHoverColor:"#00DCF5", nPaddingTop:9 }));
	sIFR.replaceElement(named({sSelector:"body follow_9", sFlashSrc:"/sifr/neosans.swf", sColor:"#26438A", sHoverColor:"#2660CD", nPaddingTop:9 }));
	sIFR.replaceElement(named({sSelector:"body follow_10", sFlashSrc:"/sifr/neosans.swf", sColor:"#003CB2", sHoverColor:"#0079B2", nPaddingTop:9 }));
	sIFR.replaceElement(named({sSelector:"body follow_11", sFlashSrc:"/sifr/neosans.swf", sColor:"#5A5A5C", sHoverColor:"#89898A", nPaddingTop:9 }));

// About Section Types
	sIFR.replaceElement(named({sSelector:"body about_4", sFlashSrc:"/sifr/neosanslight.swf", sColor:"#000", nPaddingTop:9 }));
	
};


	


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//	Field Input Functions  
//
// Clear Field Value when focused or highlight the text.
function clearValue(field) { 
	if (field.defaultValue == field.value) {
		field.value = "" ;
	}
	field.focus();
	field.select();
	
	// Avoid to lose selection.
	 event.returnValue = false;
     event.cancelBubble = true;

}

// Check if the when lose focus are empty.
function checkEmptyValue(field) { 
	if ( field.value.length==0 ) {
		field.value = field.defaultValue ;
	}
}



////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//	Main Website Object
//
// Base URL
var base_url = "http://www.seqoy.com";

var objSeqoy = {
		is_ie: navigator.userAgent.indexOf('MSIE') > 0,
		
		attr: {
			/**
			 * Cannot call : objSeqoy.is_ie. It hasn't registered yet. If you call it
			 * below this declaration, IE will not allow it. Firefox will. So you must go
			 * through the motion of using navigator.userAgent again here.
			 */
			onClick: navigator.userAgent.indexOf('MSIE') >0 ? 'onclick' : 'onClick'
		},

		follow: {
				newsletter: {}
		},
		
		blogs: {
			
		},
		
		about: {
			
		}
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//	About Section - Javascript Actions
//
function checkSubMenu( id_submenu ) {

	// Inicializa.
	if ( id_submenu == 0 ){
	
		// Marca o Sub-Menu 1.
		$( "#item_1" ).addClass("selected");
		
		// to Correct function with sFir - Make the TAB render outside of the screen.
		$( "#aboutSubContent_2" ).css({"margin-left" : "-10000px", "position" : "fixed"});	
		$( "#aboutSubContent_3" ).css({"margin-left" : "-10000px", "position" : "fixed"});	
	}

	else {
		// Demsmarca item selecionado.
		$( "#item_" + sub_menu_selected ).removeClass("selected");
		
		// Marca o Sub-Menu.
		$( "#item_" + id_submenu ).addClass("selected");
	}
	
}

objSeqoy.about = {
	select_subMenu: function( toSelect ){

		// Variables.
		currentSelected = "#aboutSubContent_" + sub_menu_selected;
		newSelected = "#aboutSubContent_" + toSelect;
		
		$( newSelected ).hide();
		$( newSelected ).css({"margin-left" : "0px", "position" : "relative"});
		
		if ( toSelect != sub_menu_selected ) {
	
			// Hide Selected Tab.	
			$( currentSelected ).slideUp("fast");
			
			// Show New Tab.
			$( newSelected ).slideDown("normal");
					
			// Marca Sub-Menu.
			checkSubMenu( toSelect );
	
			// Guard atual menul.
			sub_menu_selected = toSelect;
		}
	}

}
		
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//	Follow Section - Javascript Actions
//

objSeqoy.follow = {
	
}

// Newsletter Sign Up. 
objSeqoy.follow.newsletter = {
	request_signup: function(){
		$.post( base_url + '/db_actions/signup_newsletter.php', { email: $('#newsletterField').val() }, 
		
		function( data ) { 
				 	
					$('#newsletterMessageContainer').html( data );
				   
			   }	   
		);
	}
}





////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//	Blog Section - Javascript Test Field Actions
//
function hideContainerMessage() {
	$('#commentMessageContainer').animate({ opacity: 0 }, "slow");
}
///
objSeqoy.blogs = {
	check_comment: function(){
		
		
		var name 	= $('#comment_input_author').val();
		var email 	= $('#comment_input_email').val();
		var web 	= $('#comment_input_url').val();
		var text 	= $('#comment_input_body').val();
		var post 	= $('#comment_post_ID').val();
		var parent 	= $('#comment_parent').val();
		
		/////
		
		 var comment_author_default		  = $('#post_author_default').val();
		 var comment_author_email_default = $('#post_author_email_default').val();
		 var comment_author_url_default   = $('#post_author_url_default').val();	
		 var comment_body_text			  = $('#post_author_body').val();	
	
		/////
		
		var ret		=	'';
			
		// Author Name. 
		if( ! jQuery.trim( name ) || name == comment_author_default ) {
		 	ret += 'Por favor informe tu nombre.<br />';
		 	$('#comment_input_author').val( comment_author_default );
			
		}
 
 		// E-mail.
		if( ! jQuery.trim(  email ) || email == comment_author_email_default ) {
		
			ret += 'Por favor informe tu direcci&oacute;n de e-mail.<br />';
			$('#comment_input_email').val( comment_author_email_default );
			
		} 
		
		// Valid e-mail.
		else if ( ! /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,5})+$/.test(email) ) {
			
			ret += 'Informe un e-mail v&aacute;lido. <br />';
			$('#comment_input_email').val( comment_author_email_default );
			
		}
		
		// URL.
	 	if( web == comment_author_url_default  ) {
	 	
	 		web = "";
	 		
	 	}

		// Comment Text.
		if( ! jQuery.trim( text ) || text == comment_body_text ) {
		
			ret += "No olvid&eacute;s tu coment&aacute;rio.";
 			$('#comment_input_body').val( comment_body_text	 );
 		}
 		
		if( ret != '' ) {
			$('#commentMessageContainer').html(ret);
			$('#commentMessageContainer').animate({ opacity: 1 }, "slow");
			
		} else {
		
		//	document.commentform.submit();
			
			$.post( base_url + "/wp-comments-post.php",
				{
				author: name,
				email: email,
				url: web,
				comment: text,
				comment_post_ID: post,
				comment_parent: parent
				},
				function(data){
					$('#commentMessageContainer').html("<span style='color:#666;'>Tu coment&aacute;rio fue enviado<br>y est&aacute; aguardando aprovaci&oacute;n.");
					$('#commentMessageContainer').animate({ opacity: 1 }, "slow");
					$('#comment_name').val('');
					$('#comment_email').val('');
					$('#comment_website').val('');
					$('#comment_text').val('');
 
				});
		}
	}
}

//]]>
