$(document).ready(function(){
	$("#port-all").click(function(event){
		event.preventDefault();
	});

	var	adresaDefault =	$("#newslettersubscribe").val();
	$("#newslettersubscribe").focus(function(event){
		if ($(this).val() == adresaDefault)	{
			$(this).val('');
			}
		});
	$("#newslettersubscribe").blur(function(event){
		if ($(this).val() == '')  {
			$(this).val(adresaDefault);
		}
	});

	$('#page1').addClass('visible');
	$('#bullet1').addClass('active');
	$('#bpage1').addClass('bvisible');
	$('#bbullet1').addClass('bactive');
	
	$('#page11').addClass('visible');
	$('#bullet11').addClass('active');


	$(".stire:odd").addClass('second-stire');
	$(".lightbox").lightBox();

	$(".MsoNormal").attr('style', '').removeClass('MsoNormal');
	$("a[href='#']").attr("href", "javascript:void(0)");

	$('#close-seo, #text-seo-background').click(function(){
		$('#text-seo').fadeOut('fast', function() {
			$('#text-seo-background').fadeOut('fast');
		});
	});
	$('#open-seo').click(function(){
		$('#text-seo-background').fadeIn('fast', function()	{
			$('#text-seo').fadeIn('fast');
		});
	});



		// Carousel	portofoliu Home	Page
	function mycarousel_initCallback(carousel){
	// Disable autoscrolling if	the	user clicks	the	prev or	next button.
		carousel.buttonNext.bind('click', function() {
						carousel.startAuto(0);
			});
					carousel.buttonPrev.bind('click', function() {
			carousel.startAuto(0);
		});

					// Pause autoscrolling if the user moves with the cursor over the clip.
		carousel.clip.hover(function() {
			carousel.stopAuto();
		}, function() {
			carousel.startAuto();
		});

		setTimeout(function(){carousel.options.auto	= 3;}, 2000);
	};

	if(typeof $('#mycarousel')[0] == 'object'){

		// Initializare	Carousel

		jQuery('#mycarousel').jcarousel({
			animation:500,
			scroll:	1,
			auto: 9,
			wrap: 'last',
			initCallback: mycarousel_initCallback
		});

			//Incarca imaginile>5 dupa onload
		var	cnt	= 2000;
			var	cntFade	= 2000;
				$('ul#mycarousel li	a img').each(function(i,item){
					if(i>4 && $(item).attr("rel") != ""){
					setTimeout(function(){
						$(item).css({'display':'block'}).attr("src", $(item).attr("rel"));
					}, cnt);
					cnt+=2000;
				}
				if (i >= 0 && i	< 5) {
					setTimeout(function(){
						$(item).fadeIn(1000);
					}, cntFade);
					cntFade+=1000;
				}
		});	
	}
});
function externalLinks() {
 if	(!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor =	anchors[i];
   if (anchor.getAttribute("href") &&
	   anchor.getAttribute("rel") == "external")
	 anchor.target = "_blank";
 }
}
window.onload =	externalLinks;

function pageshow(id) {
	if ($('#page'+id).is('.visible')) {	
	} else {
		$('.visible').slideToggle("").removeClass('visible');
		$('#page'+id).slideToggle("").addClass('visible');
		$('.pagebullet.active').removeClass("active");
		$('#bullet'+id).addClass('active');
	}
}/*
function bpageshow(id) {
	if ($('#bpage'+id).is('.bvisible'))	{ 
	} else {
		$('.bvisible').slideToggle("").removeClass('bvisible');
		$('#bpage'+id).slideToggle("").addClass('bvisible');
		$('.pagebullet.bactive').removeClass("bactive");
		$('#bbullet'+id).addClass('bactive');
	}
}*/