/*	SWFProgramming 
	G-Software.it
*/
//Var 

				var rap=1;
				var W=900;
				var H=600;
				var RTt=0;
				var RLt=300;
				var RWt=600;
				var RHt=100;
				var RTc=100;
				var RLc=300;
				var RWc=600;
				var RHc=500;
				var sFuncC ="";
				var sFuncParamC ="";
				var sFuncT ="";
				var sFuncParamT ="";
				var lingua_sito = "it";
		
			    var flashvars = {};
				var params = {};
				params.quality = "high";
				params.wmode = "transparent";
				params.bgcolor = "FFFFFF";
				params.allowscriptaccess = "sameDomain";
				params.menu = "true";
				var attributes = {};
			    var id_forum_articolo=-1;
			function  AggiornaDivCentrale(center,Tc,Lc,Wc,Hc,azione,parametri) {
				
			sFuncC =azione;
			sFuncParamC=parametri;			
			RTc=Tc;
			RLc=Lc;
			RWc=Wc;
			RHc=Hc;		
			$("#contenitore").css("z-index",101);
		    ResizeFinestra("#contenitore",Tc,Lc,Wc,Hc)	
			$("#contenitore").css("visibility","visible"); 
			ajax_loadContent('divEsteso',center,"IngrandisciTutto()");

			}
			function  AggiornaDivTop(top,Tt,Lt,Wt,Ht,azione,parametri) {
			sFuncT =azione;
			sFuncParamT=parametri;			
			RTt=Tt;
			RLt=Lt;
			RWt=Wt;
			RHt=Ht;	
			$("#divTop").css("z-index",101);
			ResizeFinestra("#divTop",Tt,Lt,Wt,Ht)
			$("#divTop").css("visibility","visible");
			ajax_loadContent('divTop',top,"IngrandisciTutto()");

			}
		function  Nascondi() {
		$("#divTop").css("visibility","hidden");	
		$("#contenitore").css("visibility","hidden"); 
		$("#divTop").css("z-index",99);
		$("#contenitore").css("z-index",99);
		}

		function ResizeFinestra(Div,Top,Left,Wid,Hei) {
        rap=($(window).height()/600); 		
		W=($(window).height()/600*900);
        if (($(window).height()<=600)) {rap=1; W=900;}
		var larghezza=0;
		var altezza=altezza=parseInt(Hei*rap);		
		if (($(window).width())>W) {larghezza= parseInt($(window).width()-Left*rap-10);}else {larghezza=parseInt(W-Left*rap-10);}			
		if (Div=="#contenitore"){
		larghezza-=10;
		if ($(window).height()>H){altezza=parseInt(($(window).height()-Top*rap)-15);} else {altezza=parseInt((H-Top*rap)-15);}
		}
		$(Div).css("left",Left*rap+"px");
		$(Div).css("top",Top*rap+"px");
		$(Div).css("height",altezza+"px");
		$(Div).css("width",larghezza+"px");
		/*	if (Div=="#contenitore"){
		controllo($(window).width(),$(window).height(),Left*rap,Top*rap,altezza,larghezza,Left,Top,Wid,Hei,rap);}	*/

}

			/*function EseguiFunzione(text){alert(text);}*/

			function IngrandisciTutto() {
			$a = $('#contenitore');
			$w = $(window);
			var left=parseInt($a.css('left'));
		    var top=parseInt($a.css('top'));
			var altezza=parseInt($a.css('height'));
			var largezza=parseInt($a.css('width'));
			$c = $('#divEsteso');
			var p = (parseInt($c.css('paddingLeft')) || 0) + (parseInt($c.css('paddingRight')) || 0); 
			$('div>.jScrollPaneContainer').css({'height': altezza  + 'px', 'width':largezza + 'px'});
			$c.css({'height': (altezza-p) + 'px', 'width': (largezza - p)+ 'px', 'overflow':'auto'});
			$c.jScrollPane();
			if (sFuncParamC==""){window[sFuncC]();} else {window[sFuncC](sFuncParamC);}
			if (sFuncParamT==""){window[sFuncT]();} else {window[sFuncT](sFuncParamT);}
		//	window[sFunc]("Hello World");   alert(sFunc)
			
	     }
			$(function()
			{
				
				$.extend($.fn.jScrollPane.defaults, {
					showArrows:true,
					scrollbarWidth:15,
					arrowSize:16,
					reinitialiseOnImageLoad: true
					}
				);

				var isResizing;
		
				
				

				// and the body scrollpane
				var setContainerHeight = function()
				{
					// IE triggers the onResize event internally when you do the stuff in this function
					// so make sure we don't enter an infinite loop and crash the browser
					if (!isResizing) { 
					isResizing = true;
						$a = $('#contenitore');
						$t = $('#divTop');	
						$w = $(window);
						var largC=0;
						var alteC=0;
						var largT=0;
						var alteT=0;
						if (($(window).height()<=600)) 
						{H=600;
						 W=900;
						 rap=1;		
						 } else {
						  W=($(window).height()/600*900);
						  H=($(window).height());
						  rap=($(window).height()/600);
						   }	
						   
						if (($(window).width())>W) {
						  largC= parseInt($(window).width()-RLc*rap-20);
						  largT= parseInt($(window).width()-RLt*rap-10);	
						  }else 
						  {largC= parseInt(W-RLc*rap-20);
						   largT= parseInt(W-RLt*rap-10);
						  }
						alteT=parseInt(RHt*rap);
						if ($(window).height()>H){
						alteC=parseInt(($w.height()-RTc*rap)-15);
						}else {
						alteC=parseInt((H-RTc*rap)-15); 
						}	

						$c = $('#divEsteso');
						$a.css("width",largC+"px");
						$a.css("height",alteC+"px");
						$a.css("top",RTc*rap+"px");
						$a.css("left",RLc*rap+"px");
						$t.css("top","0px");						
						$t.css("height",alteT+"px");
						$t.css("left",RLt*rap+"px");					
						$t.css("width",largT+"px");	
     					var p = (parseInt($c.css('paddingLeft')) || 0) + (parseInt($c.css('paddingRight')) || 0);
						$('div>.jScrollPaneContainer').css({'height': alteC + 'px', 'width':largC + 'px'});
						$c.css({'height': (alteC-p) + 'px', 'width': (largC - p)+ 'px', 'overflow':'auto'});						
						$c.jScrollPane();
						isResizing = false;		
					}
					if (!swfobject.getObjectById("divflashmain")){
					swfobject.embedSWF("preloader.swf", "divflashmain",W,H, "9.0.0", false, flashvars, params, attributes);
					}else {
					swfobject.getObjectById("divflashmain").width=W;
					swfobject.getObjectById("divflashmain").height=H;
					}
				}
				$(window).bind('resize', setContainerHeight);
				setContainerHeight();
				// it seems like you need to call this twice to get consistantly correct results cross browser...
				setContainerHeight();
			});	

		function controllo(w,h,px,py,a,l,ix,iy,iw,ih,rapp){
		document.getElementById( 'windowsW' ).value=w;
		document.getElementById( 'windowsH' ).value=h;
		document.getElementById( 'posx' ).value=px;
		document.getElementById( 'posy' ).value=py;
		document.getElementById( 'altezza' ).value=a;
		document.getElementById( 'larghezza' ).value=l;
		document.getElementById( 'Ini_x' ).value=ix;
		document.getElementById( 'Ini_y' ).value=iy;
		document.getElementById( 'Ini_h' ).value=ih;
		document.getElementById( 'Ini_w' ).value=iw;
		document.getElementById( 'Rapp' ).value=rapp;

		}
	
/*function IngrandisciTutto() {
GoogleMapsINIT();
     }
*/
	function GoogleMapsINIT() {

    var myLatlng = new google.maps.LatLng(43.051828,12.5561491);
    var myOptions = {
      zoom: 6,
      center: myLatlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    }

    var map = new google.maps.Map(document.getElementById("map_google"), myOptions);
var contentString ='';
 if (lingua_sito == "it")
 {
contentString ='<div id="content_map" ><div id="siteNotice" ></div><h1 id="firstHeading" class="B18">2T Sport S.r.l.</h1><div id="bodyContent"><table width="100%" border="0" cellspacing="3" cellpadding="3"><tr><td class="B16">Produzione abbigliamento e accessori per lo sport.</td><td rowspan="2"><img src="http://cbk0.google.com/cbk?output=thumbnail&amp;w=90&amp;h=68&amp;ll=43.059165,12.541669" alt="2Tsport" /></td></tr><tr ><td class="B12">06081 Santa Maria degli Angeli<br>Via dei Fornaciai, 6 - Assisi / PG - ITALY <br>Tel. +39 075 8043394 - Fax. +39 075-8049092 <br /></td> </tr> </table></div></div>';

 }else{
contentString ='<div id="content_map" ><div id="siteNotice" ></div><h1 id="firstHeading" class="B18">2T Sport S.r.l.</h1><div id="bodyContent"><table width="100%" border="0" cellspacing="3" cellpadding="3"><tr><td class="B16">Production of sportswear and sport accessories.</td><td rowspan="2"><img src="http://cbk0.google.com/cbk?output=thumbnail&amp;w=90&amp;h=68&amp;ll=43.059165,12.541669" alt="2Tsport" /></td></tr><tr ><td class="B12">06081 Santa Maria degli Angeli<br>Via dei Fornaciai, 6 - Assisi / PG - ITALY <br>Tel. +39 075 8043394 - Fax. +39 075-8049092 <br /></td> </tr> </table></div></div>';

 }
	
	    var infowindow = new google.maps.InfoWindow({
        content: contentString
    });
    var marker = new google.maps.Marker({
        position: myLatlng,
        map: map,
        title: '2T Sport'
    });
    google.maps.event.addListener(marker, 'click', function() {
      infowindow.open(map,marker);
    });
  }

function Lingua(lg) {
	lingua_sito = lg;	
}





/*  function  AggionaCentrale(LINK){ 
	ajax_loadContent('divEsteso',LINK,"IngrandisciTutto()");
	
  }

    function  AggionaTop(LINK){ 
	ajax_loadContent('divTop',LINK,"IngrandisciTutto()");
	
  }*/

