// interblock.eu

// Switch Main Menu Tabs
function show(x)
{
	for (i=1;i<7;i++)
	{
	$(".main-tab"+i).stop(true, true).fadeOut("fast");
	}
	$(".main-tab"+x).stop(true, true).fadeIn("fast");
}

// Switch Location Bubble
function bubble(x)
{
	for (i=1;i<6;i++)
	{
		if (i != x) { 
			$(".bubble"+i).stop(true, true).fadeOut("slow"); 
		} else {
			$(".bubble"+x).stop(true, true).fadeIn("slow");
		}
	}
}


// Euroblock Star Color Variations
function showEmailPopup(x)
{
	$(".enterEmail").fadeIn("slow");
}
function hideEmailPopup(x)
{
	$(".enterEmail").fadeOut("fast");
}

// Enter email popup
function EBfadeOut(x)
{
	  for (i=1;i<7;i++)
	  {
	$(".ebimg"+i).fadeOut( "slow");
	  }
	$(".ebimg"+x).fadeIn( "slow");
}


// G4 Color Variations
var arm = 0;
var base = 0;

function G4BaseChange(x)
{
	  for (i=1;i<4;i++)
	  {
	$(".G4Base"+i).hide();
	$(".bbimg"+i).removeClass('selected');
	  }
	$(".G4Base"+x).show();
	$(".bbimg"+x).addClass('selected');
	base = x;
	updateText(arm, base);
}
function G4ArmChange(x)
{
	  for (i=1;i<11;i++)
	  {
	$(".G4Arm"+i).hide();
	$(".abimg"+i).removeClass('selected');
  }
	$(".G4Arm"+x).show();
	$(".abimg"+x).addClass('selected');
	arm = x;
	
	updateText(arm, base);
}

function updateText(arm, base) {
	var text = "";
	
	var tArm = new Array();
	tArm[1] = "black";
	tArm[2] = "silver";
	tArm[3] = "darkbrown";
	tArm[4] = "lightbrown";
	tArm[5] = "purple";
	tArm[6] = "gold";
	tArm[7] = "blue";
	tArm[8] = "darkpurple";
	tArm[9] = "red";
	tArm[10] = "green";
	
	var tBase = new Array();
	tBase[1] = "wood";
	tBase[2] = "silver";
	tBase[3] = "black";
	
	var text = "";
	if (arm > 0) {
		text = "Select base color";
		if (base > 0) {
			text = "<a href='/img/products/G4/color-variations/designs/interblock-"+tBase[base]+"-"+tArm[arm]+"-design.jpg' target='_blank'>Click here to download <br />"+tBase[base]+"-"+tArm[arm]+" design</a>";
		}
	} else {
		text = "Select armrest color";
	}
	
	
	
	$("#vText").html(text);
}


// Load youTube Video
function videoOff()
{
	$("#youTubeVideo").remove();
	$("#G4VideoBox").slideUp("slow");
}
function videoOn(x) {
	
	var video = new Array();
	video[1] = 'z1KdUWE07Ho';
	video[2] = 'x1Yqazlcr2c';
	video[3] = 'sSV59lHIScQ';
	video[4] = 'H9tcu5_7gOQ';
	video[5] = 'J2hFF8J0Cis';
	video[6] = '0iG61BspoKc';
	video[7] = 'Ku87TJ3AcZs';
	video[8] = 'jzTLmL3b-mI';
	video[9] = 'oGBw6ohpTMQ';
	video[10] = 'xTzTH9Dxo0I';
	video[11] = 'DeGu0FLDoh4';
	video[12] = 'FNoLGQsegLU';
	video[13] = 'uJdOx2ixmwk';
	video[14] = 'bD85E6y2Z-s';
	video[15] = 'dR2Ykrinszk';
	video[16] = 'lKILIdpp0vU';
	video[17] = 'vptdOnfiG14';

	$("#G4VideoBox").slideDown('slow', function() {
	$("#youTubeVideo").remove();
	$("#G4VideoBox").append('<div id="youTubeVideo"><iframe width="640" height="390" src="http://www.youtube.com/embed/' + video[x] + '?rel=0" frameborder="0" allowfullscreen></iframe></div>');
	});
};



// Left Menu Arrow Switch
function arrSelect(x)
{
	for (i=1;i<11;i++)
	{
		if (i != x) { 
			document.getElementById("arrow"+i).className=''
	    	$('#content'+"arrow"+i).css("display", "none");
	} else {
			document.getElementById("arrow"+i).className='selected'
		    $('#content'+"arrow"+i).css("display", "block");
		}
	}
}


// Else
$(document).ready(function(){


// Clear Tabs on Main Menu
$("#tabs").bind("mouseleave",function(){
      
	for (i=1;i<7;i++)
	{
		$(".main-tab"+i).stop(true, true).fadeOut("fast");
	}
	  
	})


// News Hover
$(".news-item").hover(function(){
        $(this).css('background-color', '#151515');
    },function(){
     	$(this).css('background-color', '');
});


// Switch Map
$('#map1, #maptxt1').hover(function(){
        $('#map').css('backgroundPosition', '0px 0px');
    });
$('#map2, #maptxt2').hover(function(){
        $('#map').css('backgroundPosition', '-360px 0px');
    });
$('#map3, #maptxt3').hover(function(){
        $('#map').css('backgroundPosition', '-720px 0px');
    });
$('#map4, #maptxt4').hover(function(){
        $('#map').css('backgroundPosition', '-1080px 0px');
    });
$('#map5, #maptxt5').hover(function(){
        $('#map').css('backgroundPosition', '-1440px 0px');
    });
$('#map').bind("mouseleave",function(){
        $('.eumap #map').css('backgroundPosition', '-360px 0px');
    });
$('#map').bind("mouseleave",function(){
        $('.usa #map').css('backgroundPosition', '-1080px 0');
    });
$('#map').bind("mouseleave",function(){
        $('.ap #map').css('backgroundPosition', '-720px 0px');
    });
$('#map').bind("mouseleave",function(){
        $('.canada #map').css('backgroundPosition', '-1440px 0');
    });
$('#map').bind("mouseleave",function(){
        $('.elmap #map').css('backgroundPosition', '0px 0px');
    });


});

$(window).load(function() {
	$('#slider').nivoSlider({
		effect:'fold', //Specify sets like: 'fold,fade,sliceDown'
		slices:1,
		animSpeed:700,
		pauseTime:4000,
		startSlide:0, //Set starting Slide (0 index)
		directionNav:true, //Next & Prev
		directionNavHide:true, //Only show on hover
		controlNav:false, //1,2,3...
		controlNavThumbs:false, //Use thumbnails for Control Nav
      	controlNavThumbsFromRel:false, //Use image rel for thumbs
		controlNavThumbsSearch: '.jpg', //Replace this with...
		controlNavThumbsReplace: '_thumb.jpg', //...this in thumb Image src
		keyboardNav:true, //Use left & right arrows
		pauseOnHover:true, //Stop animation while hovering
		manualAdvance:false, //Force manual transitions
		captionOpacity:0.8, //Universal caption opacity
		beforeChange: function(){},
		afterChange: function(){},
		slideshowEnd: function(){} //Triggers after all slides have been shown
	});
});

// tab switch

function tabSelect(x)
{
	
	var SelTab;
	var tmpStr;
	var Tab = new Array();
	Tab[0] = "tab01";
	Tab[1] = "tab02";
	Tab[2] = "tab03";
	Tab[3] = "tab04";
	Tab[4] = "tab05";
	Tab[5] = "tab06";
	Tab[6] = "tab07";
	Tab[7] = "tab08";
	Tab[8] = "tab09";
	Tab[9] = "tab10";

	for (SelTab in Tab) {
		tmpStr = Tab[SelTab];
		try {
		if (tmpStr.indexOf(x)>-1) {
			document.getElementById(Tab[SelTab]).className='subpage_tab_selected'
		    $('#content'+Tab[SelTab]).css("display", "block");
			document.getElementById('#content'+Tab[SelTab]).className='subpage_tab_selected'
		} else {
			document.getElementById(Tab[SelTab]).className='subpage_tab animateTab'
	    	$('#content'+Tab[SelTab]).css("display", "none");
		}
		} catch(err) {
		}

	}

	}



// left menu animation

$(function() {  
          $('.animate a').mouseover(function() {  
             $(this).stop().animate( { color:"#FFFFFF"}, "fast" );  
          }).mouseout(function() {  
             $(this).stop().animate( { color:"#999999"}, "slow" );  
          });
       }); 


// left menu with background animation

$(function() {  
          $('.subpage_button a').mouseover(function() {  
             $(this).stop().animate( { color:"#FFFFFF"}, "fast" );  
          }).mouseout(function() {  
             $(this).stop().animate( { color:"#999999"}, "slow" );  
          });
       }); 

// contact e-mail animation

$(function() {  
          $('.contact_mail a, .contact_box_dosniha a, .contact_box_bonver a, .contact_box_elam a').mouseover(function() {  
             $(this).stop().animate( { color:"#FFFFFF"}, "fast" );  
          }).mouseout(function() {  
             $(this).stop().animate( { color:"#999999"}, "slow" );  
          });
       }); 

// tab animation

$(function() {  
          $('#tab div a').mouseover(function() {  
             $(this).stop().animate( { marginTop:"5px"}, "fast" );  
          }).mouseout(function() {  
             $(this).stop().animate( { marginTop:"0px"}, "slow" );  
          });
       });  

// g4 product line

$(document).ready(function(){
    $('#submenu li').hover(function(){
        $('#carousel').css('backgroundPosition', newValue);
    }, function(){
        $('$carousel').css('backgroundPosition', '');
    });
});


$(function() {  
          $('#line_G4_1 a').mouseover(function() {  
             $('#line_title_G4_1').css('backgroundPosition', '0px -20px');
          }).mouseout(function() {  
             $('#line_title_G4_1').css('backgroundPosition', '0px 0px'); 
          });
          $('#line_G4_2 a').mouseover(function() {  
             $('#line_title_G4_2').css('backgroundPosition', '-120px -20px');
          }).mouseout(function() {  
             $('#line_title_G4_2').css('backgroundPosition', '-120px 0px'); 
          });
          $('#line_G4_3 a').mouseover(function() {  
             $('#line_title_G4_3').css('backgroundPosition', '-240px -20px');
          }).mouseout(function() {  
             $('#line_title_G4_3').css('backgroundPosition', '-240px 0px');
          });
          $('#line_G4_4 a').mouseover(function() {  
             $('#line_title_G4_4').css('backgroundPosition', '-360px -20px');
          }).mouseout(function() {  
             $('#line_title_G4_4').css('backgroundPosition', '-360px 0px');  
          });
          $('#line_G4_5 a').mouseover(function() {  
             $('#line_title_G4_5').css('backgroundPosition', '-480px -20px');
          }).mouseout(function() {  
             $('#line_title_G4_5').css('backgroundPosition', '-480px 0px');
          });
          $('#line_G4_6 a').mouseover(function() {  
             $('#line_title_G4_6').css('backgroundPosition', '-600px -20px'); 
          }).mouseout(function() {  
             $('#line_title_G4_6').css('backgroundPosition', '-600px 0px');  
          });
          $('#line_G4_7 a').mouseover(function() {  
             $('#line_title_G4_7').css('backgroundPosition', '-720px -20px'); 
          }).mouseout(function() {  
             $('#line_title_G4_7').css('backgroundPosition', '-720px 0px'); 
          });
          $('#line_G4_8 a').mouseover(function() {  
             $('#line_title_G4_8').css('backgroundPosition', '-840px -20px'); 
          }).mouseout(function() {  
             $('#line_title_G4_8').css('backgroundPosition', '-840px 0px');  
          });
       });  

// g3 product line

$(function() {  
          $('#line_G3_1 a').mouseover(function() {  
             $('#line_title_G3_1').stop().animate( { color:"#000000", backgroundColor:"#999999"}, "fast" );  
          }).mouseout(function() {  
             $('#line_title_G3_1').stop().animate( { color:"#999999", backgroundColor:"#353535"}, "slow" );  
          });
          $('#line_G3_2 a').mouseover(function() {  
             $('#line_title_G3_2').stop().animate( { color:"#000000", backgroundColor:"#999999"}, "fast" );  
          }).mouseout(function() {  
             $('#line_title_G3_2').stop().animate( { color:"#999999", backgroundColor:"#353535"}, "slow" );  
          });
          $('#line_G3_3 a').mouseover(function() {  
             $('#line_title_G3_3').stop().animate( { color:"#000000", backgroundColor:"#999999"}, "fast" );  
          }).mouseout(function() {  
             $('#line_title_G3_3').stop().animate( { color:"#999999", backgroundColor:"#353535"}, "slow" );  
          });
          $('#line_G3_4 a').mouseover(function() {  
             $('#line_title_G3_4').stop().animate( { color:"#000000", backgroundColor:"#999999"}, "fast" );  
          }).mouseout(function() {  
             $('#line_title_G3_4').stop().animate( { color:"#999999", backgroundColor:"#353535"}, "slow" );  
          });
          $('#line_G3_5 a').mouseover(function() {  
             $('#line_title_G3_5').stop().animate( { color:"#000000", backgroundColor:"#999999"}, "fast" );  
          }).mouseout(function() {  
             $('#line_title_G3_5').stop().animate( { color:"#999999", backgroundColor:"#353535"}, "slow" );  
          });
          $('#line_G3_6 a').mouseover(function() {  
             $('#line_title_G3_6').stop().animate( { color:"#000000", backgroundColor:"#999999"}, "fast" );  
          }).mouseout(function() {  
             $('#line_title_G3_6').stop().animate( { color:"#999999", backgroundColor:"#353535"}, "slow" );  
          });
          $('#line_G3_7 a').mouseover(function() {  
             $('#line_title_G3_7').stop().animate( { color:"#000000", backgroundColor:"#999999"}, "fast" );  
          }).mouseout(function() {  
             $('#line_title_G3_7').stop().animate( { color:"#999999", backgroundColor:"#353535"}, "slow" );  
          });
          $('#line_G3_8 a').mouseover(function() {  
             $('#line_title_G3_8').stop().animate( { color:"#000000", backgroundColor:"#999999"}, "fast" );  
          }).mouseout(function() {  
             $('#line_title_G3_8').stop().animate( { color:"#999999", backgroundColor:"#353535"}, "slow" );  
          });
          $('#line_G3_9 a').mouseover(function() {  
             $('#line_title_G3_9').stop().animate( { color:"#000000", backgroundColor:"#999999"}, "fast" );  
          }).mouseout(function() {  
             $('#line_title_G3_9').stop().animate( { color:"#999999", backgroundColor:"#353535"}, "slow" );  
          });
       });  

//product gallery

$(document).ready(function() {


	$("#img_thumb a").click(function(){
	
		var largePath = $(this).attr("href");
		
		$("#img_placer").attr({ src: largePath });
		
		return false;
		
	});

	$("#img_thumb2 a").click(function(){
	
		var largePath = $(this).attr("href");
		
		$("#img_placer2").attr({ src: largePath });
		
		return false;
		
	});

	$("#img_thumb3 a").click(function(){
	
		var largePath = $(this).attr("href");
		
		$("#img_placer3").attr({ src: largePath });
		
		return false;
		
	});

	$("#img_thumb4 a").click(function(){
	
		var largePath = $(this).attr("href");
		
		$("#img_placer4").attr({ src: largePath });
		
		return false;
		
	});

	$("#img_thumb5 a").click(function(){
	
		var largePath = $(this).attr("href");
		
		$("#img_placer5").attr({ src: largePath });
		
		return false;
		
	});

	$("#img_thumb6 a").click(function(){
	
		var largePath = $(this).attr("href");
		
		$("#img_placer6").attr({ src: largePath });
		
		return false;
		
	});


});

