if (ase_currentLanguage=="en") {
	var texte = ['Search:', 'Your Name', 'Your E-mail', 'Username or E-mail', 'The page will reload in <strong>', '</strong> seconds !!!', 'Full Name', 'E-mail', 'Company Name', 'City'];
} else {
	var texte = ['Cauta:', 'Numele tau', 'E-mailul tau', 'Username sau E-mail', 'Pagina se va reincarca in <strong>', '</strong> secunde !!!', 'Nume si Prenume', 'E-mail', 'Firma', 'Oras'];
}

jQuery(document).ready(function() {
	$("#pageflip").hover(function() { //On hover...
			$("#pageflip img , .msg_block").stop()
				.animate({ //Animate and expand the image and the msg_block (Width + height)
					width: '307px',
					height: '319px'
				}, 500);
			} , function() {
			$("#pageflip img").stop() //On hover out, go back to original size 50x52
				.animate({
					width: '50px',
					height: '52px'
				}, 220);
			$(".msg_block").stop() //On hover out, go back to original size 50x50
				.animate({
					width: '50px',
					height: '50px'
				}, 200); //Note this one retracts a bit faster (to prevent glitching in IE)
		});
	$("#pageflipl").hover(function() { //On hover...
			$("#pageflipl img , .msg_blockl").stop()
				.animate({ //Animate and expand the image and the msg_block (Width + height)
					width: '307px',
					height: '319px'
				}, 500);
			} , function() {
			$("#pageflipl img").stop() //On hover out, go back to original size 50x52
				.animate({
					width: '50px',
					height: '52px'
				}, 220);
			$(".msg_blockl").stop() //On hover out, go back to original size 50x50
				.animate({
					width: '50px',
					height: '50px'
				}, 200); //Note this one retracts a bit faster (to prevent glitching in IE)
		});		
	var badBrowser = (/MSIE ((5\.5)|6)/.test(navigator.userAgent) && navigator.platform == "Win32");
	if (badBrowser) {
		jQuery('img[src$=.png]').each(function() {
			fixPng(this);
		});
	}
	var se_t =texte[0];var se_t1 = texte[1];var se_t2 = texte[2];var se_t3 = texte[3];var se_t4 = texte[6];var se_t5 = texte[7];var se_t6 = texte[8];var se_t7 = texte[9];
	jQuery('#search_term').val(se_t);
	jQuery('#search_term').focus(function() {if ( jQuery(this).val() == se_t ) {
			jQuery(this).val('');
		}
	});
	jQuery('#search_term').blur(function() {if ( jQuery(this).val() == '' ) {jQuery(this).val(se_t);}});

	jQuery('#news_name').focus(function() {if ( jQuery(this).val() == se_t1 ) {jQuery(this).val('');}});
	jQuery('#news_name').blur(function() {if ( jQuery(this).val() == '' ) {jQuery(this).val(se_t1);}});
	jQuery('#news_email').focus(function() {if ( jQuery(this).val() == se_t2 ) {jQuery(this).val('');}});
	jQuery('#news_email').blur(function() {if ( jQuery(this).val() == '' ) {jQuery(this).val(se_t2);}});
	jQuery('#login_name').focus(function() {if ( jQuery(this).val() == se_t3 ) {jQuery(this).val('');}});
	jQuery('#login_name').blur(function() {if ( jQuery(this).val() == '' ) {jQuery(this).val(se_t3);}});
	jQuery('#reg_name').focus(function() {if ( jQuery(this).val() == se_t4 ) {jQuery(this).val('');}});
	jQuery('#reg_name').blur(function() {if ( jQuery(this).val() == '' ) {jQuery(this).val(se_t4);}});
	jQuery('#reg_email').focus(function() {if ( jQuery(this).val() == se_t5 ) {jQuery(this).val('');}});
	jQuery('#reg_email').blur(function() {if ( jQuery(this).val() == '' ) {jQuery(this).val(se_t5);}});
	jQuery('#reg_company').focus(function() {if ( jQuery(this).val() == se_t6 ) {jQuery(this).val('');}});
	jQuery('#reg_company').blur(function() {if ( jQuery(this).val() == '' ) {jQuery(this).val(se_t6);}});
	jQuery('#reg_city').focus(function() {if ( jQuery(this).val() == se_t7 ) {jQuery(this).val('');}});
	jQuery('#reg_city').blur(function() {if ( jQuery(this).val() == '' ) {jQuery(this).val(se_t7);}});	
		
	jQuery('#login_password').focus(function() {jQuery(this).val('');});
		
	$("#login_loading").hide();
	//$(".opacity").css({ opacity: 0.2 });
	$("#login_loading").bind("ajaxSend", function(){
		$(this).show();
		$(".opacity").css({ opacity: 0.2 });
	}).bind("ajaxComplete", function(){
		$(this).hide();
		$(".opacity").css({ opacity: 1 });
	});
	$(".login_RegisterTrigg").click(function() {
		$("#login_login").hide();
		$("#login_register").fadeIn();		
	});
	$(".login_LoginTrigg").click(function() {
		$("#login_register").hide();
		$("#login_login").fadeIn();
	
	});
	$("#news_submit").click(function() {
		Vnews_name=jQuery("#newsletter_form #news_name").val();
		Vnews_email=jQuery("#newsletter_form #news_email").val();
		$("#news_error").load("/newsletter.php", {news_name: Vnews_name, news_email: Vnews_email, lang: ase_currentLanguage}, function(response, status, xhr) {
		  if (response.search("multumim")!=-1 || response.search("Thank")!=-1) {
				$("#news_error").css({color:"#0F0"});  
		  } else {
				$("#news_error").css({color:"#F00"});    
		  }
		});
	});
	$("#reg_submit").click(function() {
		Vreg_name=jQuery("#login_form #reg_name").val();
		Vreg_email=jQuery("#login_form #reg_email").val();
		Vreg_company=jQuery("#login_form #reg_company").val();
		Vreg_city=jQuery("#login_form #reg_city").val();				
		$("#reg_error").load("/register.php", {reg_name: Vreg_name, reg_email: Vreg_email, reg_company: Vreg_company, reg_city: Vreg_city, lang: ase_currentLanguage}, function(response, status, xhr) {
		  if (response.search("instructiuni")!=-1 || response.search("instructions")!=-1) {
				$("#reg_error").css({color:"#0F0"});  
		  } else {
				$("#reg_error").css({color:"#F00"});    
		  }
		});
	});	
	$("#login_submit").click(function() {
		Vnews_name=jQuery("#login_form #login_name").val();
		Vnews_email=jQuery("#login_form #login_password").val();
		$("#login_error").load("/login.php", {login_name: Vnews_name, login_password: Vnews_email, lang: ase_currentLanguage}, function(response, status, xhr) {
		  if (response.search("succes")!=-1) {
				$("#login_error").css({color:"#0F0"});
				function showMessage(message,i){ //alert (i);
					if (i<=4) {
						$('#login_error').html(texte[4]+message+texte[5]);
					} else {
						location.reload();	
					}
		  		}
					
				var itemData = [4,3,2,1,0];				
				var i = 0;				
				function idTimer(list, i) {
				  if (!(i >= 0)) {
					 i= 0;
				  }
				  setTimeout((function(msg){
					i++;
					return function(){
					  if(i < list.length){
						idTimer(list, i);
					  }
					  showMessage(msg,i);
					}
				  })(list[i]), 1000);
				}				
				idTimer(itemData);
		  } else {
				$("#login_error").css({color:"#F00"});    
		  }
		});
	});	
	
	
	$('#flash_container').flash({
		src: '/images/swf/'+ase_currentSwf,
		width: 654,
		height: 140,
		wmode: "transparent"
	});
	$('#player').flash({
		src: '/images/swf/player.swf',
		width: 490,
		height: 620,
		allowfullscreen: true,
		flashvars: { playlistfile: '/filme.xml', backcolor: 'FFFFFF', frontcolor: '000000', lightcolor: '333333', screencolor: 'FFFFFF', playlist: 'bottom', playlistsize: '240' },
		wmode: "opaque"
	});	
	$("ul.sf-menu").supersubs({ 
            minWidth:    12,   // minimum width of sub-menus in em units 
            maxWidth:    27,   // maximum width of sub-menus in em units 
            extraWidth:  1     // extra width can ensure lines don't sometimes turn over 
                               // due to slight rounding differences and font-family 
    }).superfish({
			animation: {opacity:'show'},   // slide-down effect without fade-in 
            delay:     1200,               // 1.2 second delay on mouseout 		
			speed: 0
	});
	$("#login_bar").height(44);	
	$("#login_bar").fadeIn()
	$("#LoginTrigg").toggle(function(){
			$("#login_bar").animate({height:150});
		},function(){
			$("#login_bar").animate({height:44});
		}
	);
	$.ui.autocomplete.prototype._renderItem = function (ul, item) {
            item.label = item.label.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + $.ui.autocomplete.escapeRegex(this.term) + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "<strong>$1</strong>");
            return $("<li></li>")
                    .data("item.autocomplete", item)
                    .append("<a>" + item.label + "</a>")
                    .appendTo(ul);
        };
	$(function() {
		var cache = {},
			lastXhr;
		$( "#search_term" ).autocomplete({
			minLength: 1,
			highlight: true,
			source: function( request, response ) {
				var term = request.term;
				if ( term in cache ) {
					response( cache[ term ] );
					return;
				}

				lastXhr = $.getJSON( "/autocomplete.php?lang="+ase_currentLanguage, request, function( data, status, xhr ) {
					cache[ term ] = data;
					if ( xhr === lastXhr ) {
						response( data ); 
					}
				});
			}
		});
	});
	$("#left_ads a").tooltip({ 
		track: true, 
		delay: 0, 
		showURL: false, 
		fixPNG: true, 
		showBody: " - ", 
		extraClass: "fancy", 
		top: -15, 
		left: 5 
	});
	jQuery('#mycarousel').jcarousel({
        vertical: true,		
        scroll: 1,
		animation: 1500,
		auto: 1.5,
		wrap: "circular",
		itemFallbackDimension:140
    }); 
	 $('#scroll_bar marquee').marquee('pointer').mouseover(function () {
            $(this).trigger('stop');
        }).mouseout(function () {
            $(this).trigger('start');
        });
	jQuery("a[rel='smartToolsGallery']").colorbox({transition: "fade", slideshow:true});	
});
function fixPng(png) {
// get src
var src = png.src;
// set width and height
if (!png.style.width) { png.style.width = $(png).width(); }
if (!png.style.height) { png.style.height = $(png).height(); }
// replace by blank image
png.onload = function() { };
png.src = blank.src;
// set filter (display original image)
png.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='scale')";
}
(function(){var s=function(){__flash__removeCallback=function(i,n){if(i)i[n]=null;};window.setTimeout(s,10);};s();})();
