// JavaScript Document
//jQuery.noConflict();

function doClick(txtClientId, e)
{
    //the purpose of this function is to allow the enter key to 
    //point to the correct button to click.
    var key;

        if(window.event)
            key = window.event.keyCode;     //IE
        else
            key = e.which;     //firefox
    
    if (key == 13)
    {
        //Get the button the user wants to have clicked
        var btn = document.getElementById(txtClientId);
        if (btn != null) { //If we find the button click it
            window.location.href = "SchedaImmobile.aspx?cod=" + document.getElementById(txtClientId).value;
            //btn.click();
            event.keyCode = 0
        }
    }
}

$(document).ready(function ($) {

    $('#slideshowHolder').jqFancyTransitions({ width: 590, height: 444, delay: 4000, effect: 'curtain' });
	
    /*********ROLLOVER**********/
		// Preload dei rollover
		$("a.rollover img").each(function() {
			// Prende l'url originale
			rollsrc = $(this).attr("src");
			rollON = rollsrc.replace(/.png$/ig,"_on.png");
			$("<img>").attr("src", rollON);
		});
		
		//over del mouse
		$("a.rollover").mouseover(function(){
			imgsrc = $(this).children("img").attr("src");
			matches = imgsrc.match(/_on/);
			// non compie il rollover se il mouse è già over
			if (!matches) {
				imgsrcON = imgsrc.replace(/.png$/ig,"_on.png"); // esclude l'estensione del file
				$(this).children("img").attr("src", imgsrcON);
			}
		});
		
		//out del mouse
		$("a.rollover, a.over").mouseout(function(){
			$(this).children("img").attr("src", imgsrc);
		});
		/*********ROLLOVER**********/
		
		/******** LOGIN  **********/

		$('#login .email').focus(function () {
			if (this.value == '') {
				$(this).addClass('email');
			}
		});
		$('#login .email').blur(function () {
			if ($.trim(this.value) != '') {
				$(this).removeClass('email');
			}
		});
		
		$('#login .passw').focus(function () {
			if (this.value == '') {
				$(this).addClass('passw');
			}
		});
		$('#login .passw').blur(function () {
			if ($.trim(this.value) != '') {
				$(this).removeClass('passw');
			}
		});
		/******** LOGIN  **********/
		
});
