function doSubscribe() {
	var regEmail = /^[A-Za-z0-9\-_]+(\.[A-Za-z0-9\-_]+)*@([A-Za-z0-9\-_\.]+\.)+[A-Za-z]{2,8}$/i;
	
    if (document.getElementById('mailing').FirmEmail.value < 1) {
			alert("Please enter e-mail address!");
            document.getElementById('mailing').FirmEmail.focus();
            return false;
    } else {
        if (document.getElementById('mailing').FirmEmail.value.search(regEmail) == -1) {
            alert("Please enter valid e-mail address!");
            document.getElementById('mailing').FirmEmail.focus();
            return false;
        }
    }
}

function addQuote(id) {
	var comment = document.getElementById('comment');

	comment.innerHTML = '[quote:'+id+']\n';
	comment.focus();
}

jQuery.preloadImages = function()
{
  for(var i = 0; i<arguments.length; i++)
  {
    jQuery("<img>").attr("src", arguments[i]);
  }
}

var allImages = '';

$(document).ready(function(){
	
	$("img").each( function() { 
		$.preloadImages($(this).get(0).src);
	});
	
	//$.preloadImages("image1.gif", "/path/to/image2.png","some/image3.jpg");
	var langInfo = $("#header span#lang_togg").size();
	
	if(langInfo > 0) {
		a = setTimeout(func.hideOut, 15000);
	}
	
	
	$('#content div.left img').each(function(i){
//		console.log( $(this).width() );
		if( $(this).width() > 350 ) $(this).width(350);
	});
	$('#content div.left#index-l img').each(function(i){
//		console.log( $(this).width() );
		if( $(this).width() >= 241 ) $(this).width(241);
	});
	
	$('a#print').click(function(){
		window.open($(this).get(0).href,"print FFermio", "scrollbars=1,menubar=1,resizable=1,width=604,height=400");
		return false;
	})
	
	//POLLS
	$('a.view_poll_res, img#close_pop_res').click(function(){
		$('div#popup-results').toggle();
		return false;
	})
	//END POLLS
	
})

func = {
	hideOut : function() {
		$("#header span#lang_togg").fadeOut();
	}
}

