// External Links
function externalLinks() {
	$("a[rel='external']").attr('target','_blank');
	$(".gallery_330 p a").attr('target','_blank');
}

function insertFlash(movie_url, width, height, thelink) {
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="' + width + '" height="' + height + '">');
      document.write('<param name="movie" value="' + movie_url  + '" />');
	  document.write('<param name="wmode" value="transparent" />');
	  document.write('<param name="FlashVars" value="thelink=' + thelink + '" />');
	  document.write('<param name="allowFullScreen" value="true" />');
      document.write('<param name="quality" value="best" />');
      document.write('<embed src="' + movie_url + '"  FlashVars="thelink=' + thelink + '" quality="best" allowFullScreen="true" swLiveConnect="true" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + width + '" height="' + height + '" wmode="transparent" />');
	document.write('</object>');
}
// Spanish page - add temp message
function popSpanish() {
	 $('#lang-es > a').click (function() { 
		alert("La versión española del sitio web de EuroBLECH 2012 estará disponible a partir de mayo de 2011.");
		return false;
	});
}

// Reminder pop-up (for forgotten password)
function reminderPop() {
	remind_link = $('#reminder_link > a').attr('href');
	 $('#reminder_link > a').click (function() { 
		newwindow=window.open(remind_link, 'whatever','width=500,height=240,top=15,left=15');
		return false;
	});
}

// The language drop-down
function langsfade() {
	$("#langtrigger").click(function () {
		$("#langholder").fadeToggle("slow");
	});   


	$('body').click(function() {
		if ( $('#langholder').is(':visible')){
 			$("#langholder").fadeOut("slow");
		}
	});

	$('#langs').click(function(event){
  	 event.stopPropagation();
	});	
}
// Replace banner with Flash
function flashbanner() {
	$("#banner").flashembed({
		src: 'http://www.euroblech.com/_flash/EB2012-banner.swf',
		bgcolor: '#91368B',
		wmode: 'opaque'
	});
}

// Clear home page EuroBLECH Bulletin email input 
function clearhomeemail() {
	$('.co-bulletin .inp').focus(function() {
   		 $(this).val("");
  	});
}
// Make Privacy Policy appear onclick
function bulletin_pp() {
	$('#bulletin_pp').hide();
	$('a#toggle_pp').click(function() {
 		$('#bulletin_pp').slideToggle(900);
 		return false;
  	});
}
// Make Same stand as last yere appear onclick
function samestand() {
	$('#samestanddetails').hide();
	$('#samestand').click(function() {
		$('#samestanddetails').toggle();
	});
}
function showCats(ref) {
	theID = "tt_" + ref;
	document.getElementById(theID).style.display = "block";
}

function hideCats(ref) {
	theID = "tt_" + ref;
	document.getElementById(theID).style.display = "none";
}

// Do these functions when DOM has loaded
$(document).ready(function() {
	externalLinks();
	langsfade();
	flashbanner();
	clearhomeemail();
	bulletin_pp();
	samestand();
	reminderPop();

});

