
function buildmenu (menuid){
	 $(function() {		

$("#tab").find("ul").css({"list-style-type": "none",  "margin": "0",  "padding": "5px" })
$("#tab").find("li").css({"list-style": "none", "padding-left": "0px", display: "inline-block",	"border-bottom": "1px dotted #333333",	width: "100%"})							  
						
$("#tab").find("div").css({display: "none"})
						

var minRmHeight = "0";
var realRmHeight = ($("#longtext").height());
$("#longtext").css({height: minRmHeight + "px"});

$("#readmore").click(function()
							  {
								  if ( $("#longtext").height()==realRmHeight) 
								 	{
									  $("#longtext").animate({ 
    									    height: minRmHeight + "px"
									      }, 250 );
												$("#imgReadMoreOverviewText").attr("src", "/images/downarrow_bb.gif");
									}
								  else
								  {
									 $("#longtext").animate({ 
    									    height: realRmHeight + "px"
									      }, 250 );
										$("#imgReadMoreOverviewText").attr("src", "/images/uparrow_bb.gif");
									 
									}
							  }
							  )
							  
$("#hlpre img").click( function()
							{	
								//if ( $("#hlimg").queue().length <=1)
								//{
									var img = $(this).attr("src");
									var alt = $(this).attr("alt");
									var title = $(this).attr("title");
									var linko = $(this).attr("link");
									$("#hlimg").fadeOut('fast',function() {
											$("#hlimg").attr("src",img);
											if(linko.indexOf("MSC-Club") != -1) $("#hlimghref").attr("target","_self");
											else $("#hlimghref").attr("target","_blank");
											$("#hlimghref").attr("href",linko);
											$("#hlimg").attr("alt",alt);			
											$("#hlimg").attr("title",title);
									});
									$("#" + $(this).attr("ttext")).fadeOut('fast');
									for (j=1;j<7;j++){
										$("#hltext"+j).css({display:"none"})
									}
									$("#"+$(this).attr("ttext")).fadeIn('slow');
									$("#hlimg").fadeIn('slow');
								//}
							}
									)


$("#activelink").click( function() { 
								  if ( $("#bottomSite").height()==115) 
								 	{
									  $("#bottomSite").animate({ 
    									    height:"0px"
									      }, 1500 );
									$("#imgOtherSites").attr("src", "/images/downarrow_bb.gif");
									}
								  else
								  {
									 $("#bottomSite").animate({ 
    									    height:"115px"
									      }, 1500 );
									$("#imgOtherSites").attr("src", "/images/uparrow_bb.gif");
									 
									}
								 })
		$("#mscslidemenu ul li").hover( function() {
			 var pos = $(this).parent().offset() ;	
			 var ppos= $(this).offset();
			
				mleft= (ppos.left + $(this).width() > $(window).width()/2) ? (($(this).width() -297)+"px") :"-5px";	
		//	$(this).find("a:eq(0)").css({color:"#000035","background-color":"white"})
	//$(this).find("div").css({left:mleft,top:"19px",width:"300px"}).slideDown(jqueryslidemenu.animateduration.over)
	$(this).find("div").css({left:mleft,top:"19px",width:"300px"}).show();
			if ($.browser.msie )
			{
			mleft= (ppos.left + $(this).width() > $(window).width()/2) ? (($(this).width() - $(this).find("div").width()+3)+"px") :"-5px";	
				$(this).find("div").css({left:mleft})
			} 

												 },
												 function() {
												 //$(this).find("div").slideUp(jqueryslidemenu.animateduration.out)
												 $(this).find("div").hide()
       									 		//	$(this).find("a:eq(0)").css({color:"white","background-color":"#000035"})
												 }		) 

												 
		
												 
		

		
	 }); // document ready
}


//build menu with ID="myslidemenu" on page:
buildmenu("mscslidemenu");// JavaScript Document

// JavaScript Document
// $('#menu2').hover( function(e){alert('test')});

function moveRight(prefix, obj)
{
   if (obj.Index == obj.ImgList.length-1)
   {
        obj.Index=-1;
   }
   var destImg = document.getElementById(prefix + "Img");

   $("#"+prefix + "Img").animate({  opacity:0.2  }, 10 );
   
   destImg.setAttribute("src", obj.ImgList[obj.Index+1]);

   $("#"+prefix + "Img").animate({  opacity:1.0  }, 1000 );
   var destName = document.getElementById(prefix + "Name");
   
   //destName.firstChild.firstChild.nodeValue = obj.NameList[obj.Index+1];
   destName.innerHTML = obj.NameList[obj.Index+1];

   
   var destLink = document.getElementById(prefix + "Link");
   destLink.setAttribute("href", obj.LinkList[obj.Index+1]);

   obj.Index=obj.Index+1;
}

function moveLeft(prefix, obj)
{
   if (obj.Index == 0)
   {
        obj.Index=obj.ImgList.length;
   }
   var destImg = document.getElementById(prefix + "Img");
   $("#"+prefix + "Img").animate({  opacity:0.2  }, 10 );
  
   destImg.setAttribute("src", obj.ImgList[obj.Index-1]);
   $("#"+prefix + "Img").animate({  opacity:1.0  }, 1000 );
  
   var destName = document.getElementById(prefix + "Name");
   //destName.firstChild.firstChild.nodeValue = obj.NameList[obj.Index-1];
   destName.innerHTML = obj.NameList[obj.Index-1];
   
   var destLink = document.getElementById(prefix + "Link");
   destLink.setAttribute("href", obj.LinkList[obj.Index-1]);
   
   obj.Index=obj.Index-1;     
}

function moveRightOffers_backup()
{
   var offersFields;
   var flag;
   flag=0;	

   if (offersIndex >= offersTitleList.length)
   {
        offersIndex =-3;
        flag=1;
   }

   offersIndex = offersIndex +3;

   for (var i=1; i<=3; i++)
   {
   	
      if ((offersIndex) <= offersTitleList.length-1)
      {
				offersFields = document.getElementById("offers" + i); 
				offersFields.childNodes[0].firstChild.nodeValue = offersTitleList[offersIndex];
				offersFields.childNodes[2].nodeValue = offersDescList[offersIndex] + " da ";
		      	offersFields.childNodes[3].firstChild.nodeValue = offersPriceList[offersIndex];
				offersFields.childNodes[3].setAttribute("href", offersLinkList[offersIndex]);
		            offersIndex =offersIndex +1;  
      }
      else
      {
				offersFields= document.getElementById("offers" + i);            
				offersFields.childNodes[0].firstChild.nodeValue = "";
				offersFields.childNodes[2].nodeValue = "";
		      	offersFields.childNodes[3].firstChild.nodeValue = "";
				offersFields.childNodes[3].setAttribute("href", "");  
      }
      
	
   }
   if(flag==1)
   {
       offersIndex =0;
   }

}

function moveRightOffers()
{
   var offersFields;
   var totalOffer = offersTitleList.length;
   var flag;
   flag=0;
   
   if ((offersIndex >= totalOffer)&&(offersIndex > 0))
   {
        offersIndex =0;
        flag=1;
   }else offersIndex = offersIndex +3;

   if (offersIndex > totalOffer) offersIndex = offersIndex - totalOffer;
   var j = 0
   var old = 0
   for (var i=1; i<=3; i++)
   {
   		if (offersIndex<totalOffer)
      {
				offersFields = document.getElementById("offers" + i); 
				try{offersFields.childNodes[0].firstChild.nodeValue = offersTitleList[offersIndex];}catch(err){}
				try{offersFields.childNodes[2].nodeValue = offersDescList[offersIndex] + " da ";}catch(err){}
		    try{offersFields.childNodes[3].firstChild.nodeValue = offersPriceList[offersIndex];}catch(err){}
				try{offersFields.childNodes[3].setAttribute("href", offersLinkList[offersIndex]);}catch(err){}
				offersFields.style.visibility = "visible";
      }else{
				var indice = offersIndex-2;
				offersFieldsOld = document.getElementById("offers" + indice); 
				offersFieldsOld.style.visibility = "hidden";
  		}
  		offersIndex =offersIndex +1;  
   }
   if(flag==1)
   {
       offersIndex =0;
   }
}