function isEmail(strEmail){
validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
 if (strEmail.search(validRegExp) == -1)
 {
	return false;
 }
 return true;
}
function coverPage(objectTofade)
{
	$("#errorholder").css("z-index", 200);
	$("#errorholder").fadeTo("fast", 0.8);
	$("#" + objectTofade).css("z-index", 300);
	var theTop = $(window).offset();
	$("#" + objectTofade).css("top", (($(window).height() - $("#" + objectTofade).height()) / 2) + "px");
	$("#" + objectTofade).css("left", "50%");
	$("#" + objectTofade).css("margin-left", 0 - ($("#" + objectTofade).width() / 2) + "px");
	$("#" + objectTofade).fadeIn("slow");
}
function removeCover(objectToRemove)
{
	$("#" + objectToRemove).fadeOut("slow");
	$("#errorholder").fadeOut("fast");
	$("#errorholder").css("z-index", 0);
}
function putThisSelectInDiv(theElemnt, choosed)
{
	$(theElemnt).parent().find("div:last").html(choosed);
}
function toolTip( element_id , text )
{
	$('#'+element_id).focus(function(){
		if( $(this).val() == text ){
			$(this).val('');
		}
	});
	
	$('#'+element_id).blur(function(){
		if( $(this).val() == '' ){
			$(this).val(text);
		}
	});
}
//Rotator
var globalNextElement = 0;
var nextElement = 0;
var rotatorStatus = "pause";
function fromFlash(searchString)
{
    window.alert(searchString);
}
function playMyRotator(playingMode)
{
    if (nextElement >= images.length) {
        nextElement = 0;
    }
    if (nextElement < 0) {
        nextElement = (images.length - 1);
    }
    switch (playingMode) {
        case "goPrev":
            nextElement--;
            if (playRotator) {
                window.clearTimeout(playRotator);
            }
            playRotator = window.setTimeout('playMyRotator("normal")', 1);
			$('#rotatorPausePlay').attr('src' , 'images/pause.png' ) ;
            break;
        case "playOrPause":
            if (playRotator) {
                window.clearTimeout(playRotator);
            }
            if (rotatorStatus == "pause") {
				$('#rotatorPausePlay').attr('src' , 'images/play.png' ) ;
                rotatorStatus = "play";
            } else {
                playRotator = window.setTimeout('playMyRotator("normal")', 1);
				$('#rotatorPausePlay').attr('src' , 'images/pause.png' ) ;
                rotatorStatus = "pause";
            }
            break;
        case "goNext":
            nextElement++;
            if (playRotator) {
                window.clearTimeout(playRotator);
            }
            playRotator = window.setTimeout('playMyRotator("normal")', 1);
			$('#rotatorPausePlay').attr('src' , 'images/pause.png' ) ;
            break;
        default:
            $("#rotate-title").css("display", "none");
            $("#rotate-image").hide().attr("src", images[nextElement]).fadeIn( 1000 ) ;
            $("#news-string").html($('#'+news[nextElement]).html()) ;
            $("#news-title").html(titleA[nextElement]) ;
            if (playingMode != "normal") {
                nextElement++;
            }
            playRotator = window.setTimeout('playMyRotator("feras")', 9000);
    }
}
