/*
 * Scripts
 *
 */
	var Engine = {
		utils : {
			links : function()
			{
				jQuery('a[rel*=external]').click(function(e){
					e.preventDefault();
					window.open(jQuery(this).attr('href'));						  
				});
			},
			clickClear : function(inputName)
			{
				jQuery("input[name='" + inputName + "']").each(function(){
					$(this).attr("original_value",jQuery(this).val());
				});
				jQuery("input[name='" + inputName + "']").focus(function(){
					if(jQuery(this).val() == jQuery(this).attr("original_value")){
						jQuery(this).val("");
					}
				});
				jQuery("input[name='" + inputName + "']").blur(function(){
					if(jQuery(this).val() == ""){
						jQuery(this).val(jQuery(this).attr("original_value"));
					}
				});
			},
			activeNav : function(navCssId)
			{
				if(navCssId == '')
				{
					jQuery('.menu ul li a').each(function(){
						var host = document.location.host;
						var url = document.location.href.substring(document.location.href.indexOf(host)+host.length).toLowerCase();
						var current_href = jQuery(this).attr('href');
						current_href = current_href.toLowerCase();
						if (url == current_href) {
							jQuery(this).addClass("selected");
							jQuery(this).parents("li").addClass("selected");
						}
					});	
				}
				else
				{
					jQuery('#' + navCssId + ' li a').each(function(){
						var host = document.location.host;
						var url = document.location.href.substring(document.location.href.indexOf(host)+host.length).toLowerCase();
						var current_href = $(this).attr('href');
						if (url == current_href) {
						  jQuery(this).addClass("selected");
						  jQuery(this).parents("li").addClass("selected");
						}
					});						
				}
			},
			login : function(logged_in)
			{
				if(logged_in)
				{
					jQuery("#glbLogout").show();
				}
				else
				{
					jQuery("#glbLogin").show();
				}
			}
		}
	};
	
	jQuery(document).ready(function()
		{
			if(jQuery("#Amount").val() > 0)
			{
				jQuery("label#pm_free").hide();
			}
			else
			{
				jQuery("label#pm_cc").hide();
				jQuery("label#pm_cod").hide();
				jQuery("label#pm_pp").hide();
				jQuery("label#pm_gv").hide();
				jQuery("label#pm_free input").attr("checked",true);
			}
		}
	);
