<!--[CDATA[
/*
*************************************************************
––––––––––––––––––––––––  wrote by  –––––––––––––––––––––––––
_____________________       MINE       ______________________
____________________    www.okmine.it   _____________________

*************************** 2009 ****************************
*/


IE = document.all?true:false;
NN4 = document.layers?true:false;



// function for HOMEpage resize and position the black DIV
function scale(){
	
if(document.body.clientHeight || document.body.clientHeight>0){
	var winh = document.body.clientHeight;
	var winw = document.body.clientWidth;
	
}else if(window.innerHeight || window.innerHeight>0){
	var winh = window.innerHeight.clientHeight;
	var winw = window.innerHeight.clientWidth;
	
}else if(document.documentElement.clientHeight || document.documentElement.clientHeight>0){
	var winh = document.documentElement.clientHeight;
	var winw = document.documentElement.clientWidth;
	
}else if(document.getElementsByTagName('html').item(0).clientHeight || document.getElementsByTagName('html').item(0).clientHeight>0){
	var winh = document.getElementsByTagName('html').item(0).clientHeight;
	var winw = document.getElementsByTagName('html').item(0).clientWidth;
}
	
	if(IE){
		var img_bg = document.getElementById("img_bg");
		var logo_enter = document.getElementById("logo_enter");
		var credits = document.getElementById("credits");
		var credits_100 = document.getElementById("credits_100");
		var credits_80 = document.getElementById("credits_80");
		var bodi = document.body;
	}else if(NN4){
		var img_bg = document.layers["img_bg"];
		var logo_enter = document.layers["logo_enter"];
		var credits = document.layers["credits"];
		var credits_100 = document.layers["credits_100"];
		var credits_80 = document.layers["credits_80"];
		var bodi = document.layers["body"];
	}else{
		var img_bg = document.getElementById("img_bg");
		var logo_enter = document.getElementById("logo_enter");
		var credits = document.getElementById("credits");
		var credits_100 = document.getElementById("credits_100");
		var credits_80 = document.getElementById("credits_80");
		var bodi = document.getElementsByTagName('body').item(0);
	}
	var html = document.getElementsByTagName('html').item(0);
	
	if(winh<max_size_h){
			if(winh<(max_size_h*0.5) || winw<(max_size_w*0.3)){
			// MINIMUM resize so add scrollbar
				bodi.style.overflowX = "auto";
				html.style.overflowX = "auto";
				bodi.style.width = (max_size_h*winw/max_size_w)+"px";
			}else{
				bodi.style.overflowX = "hidden";
				html.style.overflowX = "hidden";
				bodi.style.width = "100%";
			}
			bodi.style.overflowY = "hidden";
			html.style.overflowY = "hidden";
		// if the winwow size is LESS than image
		// check the proportion between W and H (1000:625)
			if(winh > (winw*625/1000)){
				var act_h = winh;
				var act_w = (max_size_w*winh/max_size_h);
			}else{
				var act_h = (max_size_h*winw/max_size_w);
				var act_w = winw;
			}
		// img
			img_bg.style.height=act_h+"px";
			img_bg.style.width=act_w+"px";
		// credits
			credits_80.style.width = act_w+"px";
			credits_80.style.height = act_h+"px";
			credits_100.style.bottom = (pos_bottom*act_h/max_size_h) + "px";
		// distance BOX LOGO
			logo_enter.style.bottom = (pos_bottom*act_h/max_size_h) + "px";
		
	}else{
	// if the winwow size is MORE than image
		img_bg.style.height=max_size_h+"px";
		img_bg.style.width=max_size_w+"px";
		logo_enter.style.bottom = (winh - max_size_h) + pos_bottom+"px";;
	// credits
		credits_80.style.width = max_size_w+"px";
		credits_80.style.height = max_size_h+"px";
		credits_100.style.bottom = (winh - max_size_h) + pos_bottom+"px";
	}
	logo_enter.style.visibility="visible";
	
}

// credits SHOW/HIDDE
function credits(){
	var credits_100 = document.getElementById("credits_100");
	var credits_80 = document.getElementById("credits_80");
	
	(credits_100.style.zIndex==2 || !credits_100.style.zIndex) ? credits_100.style.zIndex = 201 : credits_100.style.zIndex = 2;
	(credits_80.style.zIndex==1 || !credits_80.style.zIndex) ? credits_80.style.zIndex = 200 : credits_80.style.zIndex = 1;
	(credits_100.style.display=="none" || !credits_100.style.display) ? credits_100.style.display = "block" : credits_100.style.display = "none";
	(credits_80.style.display=="none" || !credits_80.style.display) ? credits_80.style.display = "block" : credits_80.style.display = "none";
}
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// function profilo | show or not the box_profilo
function show_slideshow(lang){
	var map_img = document.getElementById('show_slideshow');
	if(map_img.src.indexOf('close')>-1 || map_img.src.indexOf('chiudi')>-1){
	map_img.src = "img/info.gif";
	window.document.slide_bl_2.SetVariable("box_profilo_play", true);
	}else{
		if(lang=="it"){
	map_img.src = "img/chiudi_120.gif";
		}else{
	map_img.src = "img/close_120.gif";
		}
	window.document.slide_bl_2.SetVariable("box_profilo_play", true);
	}
}
// functions per CONTACTS | check email @ | show GOOGLE map
function check_email(form_name){
	
	if(form_name.email.value.indexOf('@')==-1){
		alert('la email non e\' valida');
		return false;
	} else{ return true; }	
}

function show_map(lang){
	var map_img = document.getElementById('show_map_img');
	if(map_img.src.indexOf('close')>-1 || map_img.src.indexOf('chiudi')>-1){
	map_img.src = "img/google_map.gif";
		if(lang=="it"){
document.getElementById('table_contacts').innerHTML='<div style="padding-left:34px;"><p id="p_title" class="txt_white">NEWSLETTERS<br /><br /><br />inserisci la tua e-mail per ricevere tutte le informazioni inerenti<br />leo torri photographer</p><iframe src="http://www.leotorri.com/cms/it/node/2" style=" background-color:#161616;width:760px; height:72px;" frameborder="0" marginheight="0" marginwidth="0" scrolling="no"></iframe><p id="p_address" class="txt_white">leo torri &amp; c. s.a.s.<br />di leonardo torri<br /><br />via paruta _76<br />20127 milano italy<br />t. +39 02 2592515<br />f. +39 02 25902035<br /><br /><a href="mailto:info@leotorri.it" class="link_orange">info@leotorri.it</a></p></div>';
		}else{
document.getElementById('table_contacts').innerHTML='<div style="padding-left:34px;"><p id="p_title" class="txt_white">NEWSLETTERS<br /><br /><br />write your email for recieve the informations about us<br />leo torri photographer</p><iframe src="http://www.leotorri.com/cms/en/node/2" style=" background-color:#161616;width:760px; height:72px;" frameborder="0" marginheight="0" marginwidth="0" scrolling="no"></iframe><p id="p_address" class="txt_white">leo torri &amp; c. s.a.s.<br />di leonardo torri<br /><br />via paruta _76<br />20127 milano italy<br />t. +39 02 2592515<br />f. +39 02 25902035<br /><br /><a href="mailto:info@leotorri.it" class="link_orange">info@leotorri.it</a></p></div>';			
		}
	}else{
		
	map_img.src = (lang=="it")?"img/chiudi_120.gif" : "img/close_120.gif";
	
document.getElementById('table_contacts').innerHTML='<iframe id="id_gmap" width="793" height="545" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.it/maps?f=q&amp;source=s_q&amp;hl=it&amp;geocode=&amp;q=via+paruta+76,+20127,+milano,+italy&amp;sll=41.442726,12.392578&amp;sspn=17.838012,28.300781&amp;ie=UTF8&amp;s=AARTsJrt03KQ3njJrcs4YM1sYEq8iwiLFA&amp;ll=45.505324,9.240317&amp;spn=0.016392,0.034032&amp;z=15&amp;iwloc=addr&amp;output=embed"></iframe>';
	}
	
}
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// variable for only the first time browsing a category (from the menu Blocco_1b)
ok_temp_info = false;
// var image
newImage = new Image();
//^^^^^^^^^^^^^^^^^^^^^^
function showLoading(){
	window.document.getElementById('loading_t').style.width= loading_w+"px";
	window.document.getElementById('loading_t').style.height= loading_h+"px";
	window.document.getElementById('loading').style.width= loading_w+"px";
	window.document.getElementById('loading').style.height= loading_h+"px";
	window.document.getElementById('loading').style.marginTop= -(loading_h/2-4)+"px";
	window.document.getElementById('loading').style.visibility= "visible";
	window.document.getElementById('loading').style.display= "block";
}
function showImage(){
	if(window.document.getElementById('info_txt')){
		window.document.getElementById('info_txt').style.visibility="visible";
	}
	if(window.document.getElementById('abc')){
		window.document.getElementById('abc').style.visibility='visible';
	}
	window.document.getElementById('loading').style.width= "0px";
	window.document.getElementById('loading').style.height= "0px";
	window.document.getElementById('loading').style.visibility= "hidden";
	window.document.getElementById('loading').style.display= "none";
	if(!ok_temp_info && window.document.getElementById('info_box')){
		window.setTimeout("display_info()",800);
		window.setTimeout("display_info()", 4000);
	}
	ok_temp_info = false;
}
function imgLoad(myImg,alt_txt){
	var video=document.getElementById("video_id");
	if(video){
		myVideo=myImg.split("img/video/");
		video.style.display= "block";
		getVideo(myVideo[1]);
		showImage();
	
	}else{
	
		var alt_txt = (alt_txt=="undefined")?"":alt_txt;
		showLoading();
		newImage.onload= function(){
			if(window.document.getElementById('img_bl_2')){
				window.document.getElementById('img_bl_2').src=this.src;
				window.document.getElementById('img_bl_2').alt=alt_txt;
			}
			showImage();
		}
		newImage.src = myImg;
		
	}
}


// functions to FLASH
function ok_go_bl_2(src_img,numb_icon, n_subcat,alt_big){
	
//	img_bl2.setAttribute("src",src_img);
	var alt_big = (alt_big=="undefined")?"":alt_big;
	imgLoad(src_img,alt_big);
//  passo variabili blocco 3: numero SWF, numero nodo XML, item attivo
	window.document.menu_bl_3.SetVariable("numb_icon", numb_icon);
	window.document.menu_bl_3.SetVariable("n_subcat", n_subcat);
	window.document.menu_bl_3.SetVariable("item_act", 1);
	
}

function display_img(){
	
	if(window.document.getElementById('img_bl_2')){
		window.document.getElementById('img_bl_2').style.display="block";
	}
	
	window.document.getElementById('bl2_swf').innerHTML='<div class=\"bgBlack_bl2\">&nbsp;</div>';

	if(window.document.getElementById('table_contacts')){
		window.document.getElementById('table_contacts').style.visibility='visible';
		window.document.getElementById('info_txt').style.visibility='visible';
	}
	
}

function display_infotxt_profilo(){
	window.document.getElementById('info_txt').style.visibility='visible';
}
//**************************************************************
// da flash | NO refresh page
function src_img_fn(src_img,alt_txt){
	ok_temp_info = true;
	var alt_txt = (alt_txt=="undefined")?"":alt_txt;
	imgLoad(src_img,alt_txt);
//	img_bl2.src=src_img;
}

function change_subcategory(src_img, numb_icon, n_subcat,alt_big){
	// mando in play blocco 3 per resettarlo
	window.document.menu_bl_3.Play();
	// nascondo IMG BIG
	if(window.document.getElementById('img_bl_2'))
		window.document.getElementById('img_bl_2').style.display="none";
	// nascondo div INFO se c'è
	if(window.document.getElementById('info_txt')){
		window.document.getElementById('info_txt').style.visibility="hidden";
	}
	if(window.document.getElementById('abc')){
	//	window.document.getElementById('abc').style.visibility='hidden';
	}
	// cambio SRC img BIG
	var alt_big = (alt_big=="undefined")?"":alt_big;
	imgLoad(src_img,alt_big);
	
	// funzione passa variabile blocco 3
	set_blocco3(numb_icon,n_subcat);
	//
	display_img();
}

function set_blocco3(numb_icon,n_subcat){
	// invio variabili al menu BLOCCO 3
	// n_subcat = quale dei 4 SWF con miniature devo caricare ( da 2 a 4 )
	window.document.menu_bl_3.SetVariable("numb_icon", numb_icon);
	// item_act = numero ITEM SUBCATEGORY per estrarre i dati dal nodo XML
	window.document.menu_bl_3.SetVariable("n_subcat", n_subcat);
	// numb_icon = quale icona è attiva (1)
	window.document.menu_bl_3.SetVariable("item_act", 1);
}

//**************************************************************
// INFO
function write_info(txt){
	var amp_txt= txt.replace(/&amp;/g,"&");
	document.getElementById('info_box').innerHTML = "<div class=\"traspa\">&nbsp;</div>"+"<p class=\"txt_white\">"+amp_txt+"</p>";
}
function write_info_books(txt, pdf_src, pdf_size){
	window.document.books_info_swf.SetVariable("_root.info_txt", txt);
	window.document.books_info_swf.SetVariable("_root.pdf_src", pdf_src);
	window.document.books_info_swf.SetVariable("_root.pdf_size", pdf_size);
}
function display_info(){
	var display = window.document.getElementById('info_box').style.display;
	(display=="none") ? window.document.getElementById('info_box').style.display = "block" : window.document.getElementById('info_box').style.display = "none";
}
// richiesta form
function title_to_richiedi(title_book){
	window.document.getElementById('info_txt_a').href = "javascript:PopUp('"+title_book+"');";
}

function bg_black(n){
	if(n===2) var div_bg=window.document.getElementById('bl2');
	if(n===3) var div_bg=window.document.getElementById('bl3');
	div_bg.style.backgroundColor="#000000";
}

function change_video(src_video,info){
	jQuery("#img_e_info > table").css("background-color", "#000000");
	//write_info(info);
	jQuery('#info_box').html("<div class=\"traspa\">&nbsp;</div>"+"<p class=\"txt_white\"></p>");
	var info_br= info.replace(/&lt;br \/&gt;/g,"<br />");
//	var info_br= txt.replace(/<br />/g,"");
	jQuery('#info_box p').html(info_br);
	window.document.getElementById('info_txt').style.visibility="visible";
	window.setTimeout("display_info()",800);
	window.setTimeout("display_info()", 4000);
	
	var video=document.getElementById("video_id");
//	myVideo=myImg.split("img/video/");
	video.style.display= "block";
	getVideo(src_video);
	
}
-->

