// External Links
function externalLinks() {
	$("a[rel='external']").attr('target','_blank');
}
// Print Page
function createPrintlink() {
	 $('#print-page > a').click (function() { window.print();});
}

// Email page - add pop-up behaviour
function emailPage() {
	emailpage_link = $('#email-page > a').attr('href');
	 $('#email-page > a').click (function() { 
		var randomnumber=Math.floor(Math.random()*101);
		windowname = 'emailwindow' + randomnumber;
		newwindow=window.open(emailpage_link,windowname,'width=570,height=440,top=15,left=15');
		return false;
	});
}
function insertFlash(base_url, movie, width, height) {
	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="' + base_url + '/_flash/' + movie + '.swf" />');
	  document.write('<param name="wmode" value="transparent" />');
      document.write('<param name="quality" value="best" />');
      document.write('<embed src="' + base_url + '/_flash/' + movie + '.swf"  quality="best" swLiveConnect="true" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + width + '" height="' + height + '" wmode="transparent" />');
	document.write('</object>');
}
function insertTeaser(base_url, movie, videolink) {
	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="141" height="103">');
      document.write('<param name="movie" value="' + base_url + '/_flash/' + movie + '.swf" />');
	  document.write('<param name="wmode" value="transparent" />');
	  document.write('<param name=FlashVars value="videolink=' + videolink + '">');
      document.write('<param name="quality" value="best" />');
      document.write('<embed src="' + base_url + '/_flash/' + movie + '.swf"  quality="best" FlashVars="videolink=' + videolink + '" swLiveConnect="true" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="141" height="103" wmode="transparent" />');
	document.write('</object>');
}

// EWL Sample - add pop-up behaviour
function popSample() {
	the_link = $('.viewsample1').attr('href');
	 $('.viewsample1').click (function() { 
		newwindow=window.open(the_link,'name','width=980,height=500,top=15,left=5, scrollbars=yes');
		newwindow.focus();
		return false;
	});
	 
	 the_link2 = $('.viewsample2').attr('href');
	 $('.viewsample2').click (function() { 
		newwindow=window.open(the_link2,'name','width=980,height=500,top=15,left=5, scrollbars=yes');
		newwindow.focus();
		return false;
	});
	 
	  the_link3 = $('.viewsample3').attr('href');
	 $('.viewsample3').click (function() { 
		newwindow=window.open(the_link3,'name','width=980,height=500,top=15,left=5, scrollbars=yes');
		newwindow.focus();
		return false;
	});
}

// French page - add temp message
function popFrench() {
	 $('#lang-fr > a').click (function() { 
		alert("Le site Internet français d'EuroBLECH 2010 sera disponible à partir de mai 2009.");
		return false;
	});
}
// Italian page - add temp message
function popItalian() {
	 $('#lang-it > a').click (function() { 
		alert("Il sito web italiano di EuroBLECH 2010 sarà disponibile da maggio 2009.");
		return false;
	});
}
// Spanish page - add temp message
function popSpanish() {
	 $('#lang-esp > a').click (function() { 
		alert("La versión española del sitio web de EuroBLECH 2010 estará disponible a partir de mayo de 2009.");
		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;
	});
}




// Do these functions when DOM has loaded
$(document).ready(function() {
	createPrintlink();
	externalLinks();
	emailPage();
	reminderPop();
	popSample();
	$("#tabbednav").idTabs();
});
