/**
* 
* efectes roll-over destacats, funció menu i rotació noticies
*/ 
//function init(){ 
	   
 
jQuery(document).ready(function(){
//////////////////GENERAL////////////////////////
	if((navigator.appName!='Firefox')&&(navigator.appName!='Mozilla')&&(navigator.appName!='Opera')) {
		if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //test for MSIE x.x;
			 var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number
			 if (ieversion<7) window.location="http://www.digital360.cat/web/incompt.html"; 
		}
	}
	
	if((navigator.userAgent.search("Firefox/3.5")<0)&&(navigator.userAgent.search("Firefox/3.6")<0)&&(navigator.userAgent.search("MSIE")<0)&&(navigator.userAgent.search("Chrome")<0)&&(navigator.userAgent.search("Safari")<0)) {
		if(document.getElementById('titol-showcase')!=null){
			jQuery('#titol-showcase img').css("margin-top","0px"); 
			jQuery('#titol-showcase img').css("float","none");
		}
				
	}
	if(navigator.userAgent.search("Firefox/2")>0){
		jQuery('input#bt_buscar').css("float","none"); 
	//	if(document.getElementById('titol-showcase')!=null){
			//jQuery('#titol-showcase img').css("margin-top","-25px");
		//	jQuery('#titol-showcase img').css("padding-bottom","8px");
		//}
			
	}
	if((navigator.appName=='Opera')||(navigator.appName=='Netscape')){
		if(document.getElementById('titol-showcase')!=null) jQuery('#titol-showcase img').css("margin-top","-4px");
	}
///////////////mouse over destacats//////////////
	if((document.getElementById('info-content')!=null)){
		jQuery('.cont_projecte').mouseover(function(){
			jQuery(this).addClass("actiu");
		});
		
		jQuery('.cont_projecte').mouseleave(function(){
			jQuery(this).removeClass("actiu");
		});
	}


/////////////// rotar noticies ///////////////////
	if(document.getElementById('news_dest')!=null) jQuery('#news').innerfade({animationtype: 'slide', speed: 2000, timeout: 5000, type: 'random'});
		
//////////////////titols amb font-family Cufon///////////////
 	
	/*if(document.getElementById('news_dest')!=null)*/
	Cufon.replace('.titol_projecte'); 
	if(document.getElementById('titol-content')!=null) Cufon.replace('.fontCufon'); 
	
	Cufon.replace('ul#menu-head a', { hover: true } ); 
	Cufon.refresh();
	
	
//////////////////apartats galeria d'imatges///////////////
	if(document.getElementById('galeria')!=null){//.seekTo(this.getPageIndex())

/*jQuery("#galeria").scrollable({size:5,next:".nextS",prev:".prevS"}).mousewheel().find("a").overlay({target: '#imatges', expose: '#000000',closeOnClick: false }).gallery({ speed: 800});*/
		jQuery("#galeria").scrollable({size: 6,next:".nextS",prev:".prevS"}).mousewheel().find("a").each(function(index) {
			jQuery(this).overlay({
				absolute :'true',
				target: '#imatges',
				expose: '#000000',
				closeOnClick: true,
				onLoad: function() { jQuery("#galeriImg").scrollable({size:6});}
			});
		}).gallery({opacity:1, speed: 800, autohide:false, template: '<span class="titImg">'+jQuery('#items li a').attr('title')+'</span><span class="numImg"> ${index} / ${total}</span>'});

	// scrollable inside the box. Its API is assigned to the "images" variable
	//var images = jQuery("#galeriImg").scrollable({size: 1, api:true}); 
	//var maxImg=images.getSize(); images.seekTo(index-1, 0); //alert(images.getSize());

		if(document.getElementById('commentForm')==null) jQuery('#galeria').jqDock({size:56, align: 'bottom', duration:300});
	}
	
//////////////////noticies menu desplegable///////////////////////
	if(document.getElementById('menu_noticies')!=null) jQuery('ul.sf-menu').superfish();
	
	/*jQuery('a div').css({'margin-left':'10px', 'background-position':'right 80%'});*/

});

//}
////////////////////  menu    ////////////////////////////
	
window.addEvent('load', function(){
	var textmenu = new BySlideMenu('textmenu', {defaultIndex: 1, elementHeight: 123, elementWidth: 200	});
});


//////////////////// google maps ////////////////////////
function ubicam(){
	//href="http://maps.google.es/maps/ms?ie=UTF8&hl=es&msa=0&msid=114830513816856100440.00047e9a6e4b6e4680499&ll=41.411063,2.200345&spn=0.005979,0.013937&z=17&output=embed";
	href="http://maps.google.es/maps?f=q&source=s_q&hl=es&geocode=&q=digital360&sll=41.412159,2.201078&sspn=0.012134,0.027874&g=carrer+peru+174&ie=UTF8&ll=41.412351,2.201085&spn=0.011731,0.027874&z=16&iwloc=A&output=embed";
	window.open(href); 
}



