/*var timeOutTable = new Array;
*/
function ask_user(question) {
    var windowResult = confirm(question);

    if (windowResult == true) {
        return true;
    } else {
        return false;
    }
}


function main() {
	/*preload();
	
	$("div.top_menu_item").mouseenter(function(event){
		id = $(this).attr("rel");
		hideAll(id)
		$("div#scrool_menu_" + id).fadeIn("fast");
 		$("div.top_menu_item img#top_menu_item_img_"+ id).attr("src","/_img/pl/top_menu/0"+id+"_sel.jpg")
		});

	$("div.top_menu_item").mouseleave(function() {
		id = $(this).attr("rel");
		startHiding(id);
		$("div.top_menu_item img#top_menu_item_img_"+ id).attr("src","/_img/pl/top_menu/0"+id+".jpg")
		});
		*/

	$("div.content_contener_left_top_left_box").mouseenter(function(event){
		$(this).css("background-image", "url('/_img/_content_contener_left_top_left_box_bg_hover.jpg')");
		});
	$("div.content_contener_left_top_left_box").mouseleave(function(event){
		$(this).css("background-image", "url('/_img/_content_contener_left_top_left_box_bg.jpg')");
		});


	$("#form00").submit(function() {
		$("img#img_name").fadeOut("fast")
		$("img#img_firma").fadeOut("fast")
		$("img#img_email").fadeOut("fast")
		$("img#img_tel").fadeOut("fast")
		$("img#img_message").fadeOut("fast")
		var t = true;
		if($("input[name='name']").val() == "") {
			$("img#img_name").fadeIn("fast")
			t = false
			}
		if($("input[name='firma']").val() == "") {
			$("img#img_firma").fadeIn("fast")
			t = false
			}
		if($("input[name='email']").val() == "") {
			$("img#img_email").fadeIn("fast")
			t = false
			}
		if($("input[name='tel']").val() == "") {
			$("img#img_tel").fadeIn("fast")
			t = false
			}
		if($("textarea#message").val() == "") {
			$("img#img_message").fadeIn("fast")
			t = false
			}
		return t;
		});
	}
$(function() {
	$('img.thumb').click(function() {		 
		id = $(this).attr('rel');
		id = Number(id);
		current_image = id;
		id = image_array[id];		
		$('.description').hide();
		$('#description_' + id).show();
		$('#gallery_main').hide();		
		var img = new Image();
        $(img).load(function () {
        	$('#gallery_main_image .editable').html('');
            $('#gallery_main_image .editable').append(this);
            temp = $('#gallery_main_image .editable').html();
            temp = '<a href="/d_image/' + id + '/w/800/">'+temp+'</a>';
            $('#gallery_main_image .editable').html(temp);
            $('#gallery_main_image .editable img').css('border', '0');
            $('#gallery_main_image a').lightBox();                        
            $('#gallery_main').fadeIn();
        }).error(function () {
           // error
        }).attr('src', '/d_image/' + id + '/w/454/h/300/');
        
	});
	$("img.prev_image").live("click", function() {			
		if (current_image > 0) {
			current_image = current_image - 1;			
		} else {
			current_image = image_array.length - 2;			
		}
		
		id = image_array[current_image];
		$('.description').hide();
		$('#description_' + id).show();
		$('#gallery_main').hide();		
		var img = new Image();
        $(img).load(function () {
        	$('#gallery_main_image .editable').html('');
            $('#gallery_main_image .editable').append(this);
            temp = $('#gallery_main_image .editable').html();
            temp = '<a href="/d_image/' + id + '/w/800/">'+temp+'</a>';
            $('#gallery_main_image .editable').html(temp);
            $('#gallery_main_image .editable img').css('border', '0');
            $('#gallery_main_image a').lightBox();                        
            $('#gallery_main').fadeIn();
        }).error(function () {
           // error
        }).attr('src', '/d_image/' + id + '/w/454/h/300/');	
	});
	$("img.next_image").live("click", function() {		
		if (current_image < image_array.length - 2) {
			current_image = current_image + 1;			
		} else {
			current_image = 0;			
		}
		
		id = image_array[current_image];
		$('.description').hide();
		$('#description_' + id).show();
		$('#gallery_main').hide();		
		var img = new Image();
        $(img).load(function () {
        	$('#gallery_main_image .editable').html('');
            $('#gallery_main_image .editable').append(this);
            temp = $('#gallery_main_image .editable').html();
            temp = '<a href="/d_image/' + id + '/w/800/">'+temp+'</a>';
            $('#gallery_main_image .editable').html(temp);
            $('#gallery_main_image .editable img').css('border', '0');
            $('#gallery_main_image a').lightBox();                        
            $('#gallery_main').fadeIn();
        }).error(function () {
           // error
        }).attr('src', '/d_image/' + id + '/w/454/h/300/');
	});
	
	$('a.tab_1_btn').click(function() {		
		$('.tab_1').show();
		$('.tab_2').hide();
		$('#content_contener_left_top_right_head').css('background-image','url("/_img/_content_contener_left_top_right_head_bg.jpg")');
		return false;
				
	});
	$('a.tab_2_btn').click(function() {
		$('.tab_2').show();		
		$('.tab_1').hide();
		$('#content_contener_left_top_right_head').css('background-image','url("/_img/_content_contener_left_top_right_head_bg_2.jpg")');
		return false;			
	});
});

function hideAll(id) {
		for (i=1; i<=9;i++) {
			if (i != id) {
				hideSubMenu(i);
				}
			}
	}
function hideSubMenu(id) {
	$("div#scrool_menu_" + id).fadeOut("fast");
	}
function startHiding(id) {
	timeOutTable[id] = setTimeout('hideSubMenu(\'' + id +'\')', 100)
	}
function stopHiding(id) {
	clearTimeout(timeOutTable[id]);
	}

/*
function preload()
	{
	imageObj = new Image();
	images = new Array();
	images[0]="/_img/_content_contener_left_top_left_box_bg_hover.jpg";
	images[1]="/_img/pl/top_menu/00_sel.jpg";
	images[2]="/_img/pl/top_menu/01_sel.jpg";
	images[3]="/_img/pl/top_menu/02_sel.jpg";
	images[4]="/_img/pl/top_menu/03_sel.jpg";
	images[5]="/_img/pl/top_menu/04_sel.jpg";
	images[6]="/_img/pl/top_menu/05_sel.jpg";
	images[7]="/_img/pl/top_menu/06_sel.jpg";
	images[8]="/_img/pl/top_menu/07_sel.jpg";
	images[9]="/_img/pl/top_menu/08_sel.jpg";
	images[10]="/_img/pl/top_menu/08_sel.jpg";

	for(var i=0; i < images.length; i++) {
		imageObj.src = images[i];
		}
	}
*/
