/*
ShowPopup
ShowMenu
ShowLanguageButtons
ShowImage
ShowFrame
ShowLogo
ShowLink

CartItem
CartView
*/

function multi_ShowPopup( url,winName,W,H,X,Y)
{
	if (W == undefined) W = 400;	//default width
	if (H == undefined) H = 300; //default height
	if (X == undefined) X = screen.width/2 - W/2; //default Xpos (is now centered)
	if (Y == undefined) Y = screen.height/2 - H/2; //default Ypos (is now centered)

	winprops = 'height='+H+',width='+W+',top='+X+',left='+Y+',scrollbars=no,status=no';

	win = window.open(url, winName, winprops);
	if (parseInt(navigator.appVersion) >= 4)
		win.window.focus();
	
	return false;
}

function multi_ShowMenu( aLanguage, aLineColor )
{
	var links = new Array;
	if ( aLanguage == 'nl' ) links = new Array ( "Home", "Catalogus", "Bestellen", "Reacties", "Achtergrond", "Contact" );
	if ( aLanguage == 'en' ) links = new Array ( "Home", "Catalogue", "Order", "Reviews", "About", "Contact" );
	
	// Split the URL till we have the FileName left.
	var loc = String( this.location );
	loc = loc.split("/");
	loc = loc[loc.length-1].split(".");
	loc = loc[loc.length-2];
	
	document.write( '<table width="140" class="menu"><tr><td><hr noshade color="' + aLineColor + '" size="1" width="140" /></td></tr></table>' );
	for( var i=0; i<links.length; i++ )
	{
		var menuClass = (loc==links[i]) ? 'menu_active' : 'menu_normal';
		var link = '<table width="140" class="menu"><tr><td align="right"><a href="' + links[i] + '.html" class="' + menuClass + '">' + links[i] + '</a>';
		link += '<span style="line-height:2px;"><br /><hr noshade color="' + aLineColor + '" size="1" width="140" /></span></td></tr></table>';
		// alert( 'location=' + loc + ', links=' + links[i] + ', class=' + menuClass );
		document.write( link );
	}

}

function multi_ShowImage(url,width,height)
{
	var theHTML = '<span style="width:'+width+'px;height:'+height+'px;display:inline-block;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + url + '\');">';
	theHTML += '<img style="filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" src="' + url + '" width="' + width + '" height="' + height + '" border="0" alt=""></span>';
	document.write( theHTML );
}

function multi_ShowLogo( aLanguage )
{
	multi_ShowImage( '../resources/image/logo/logo_' + aLanguage + '.png' );
}

function multi_ShowLink( aLanguage )
{
	var theText = '';
	if ( aLanguage == 'nl' ) theText = 'Anderen over de cd\'s van<br />Meeuwsen Natuurgeluiden...';
	if ( aLanguage == 'en' ) theText = 'Others about the cd\'s of<br />Meeuwsen Natuurgeluiden...';
	
	var theLink = '';
	if ( aLanguage == 'nl' ) theLink = 'Reacties.html';
	if ( aLanguage == 'en' ) theLink = 'Reviews.html';
	
	var theHTML = '';
	theHTML += '<table><tr><td><a href="' + theLink + '" class="link">' + theText + '</a></td></tr></table>';
	
	document.write( theHTML );
}

function multi_ShowLanguageButtons()
{
	var theHTML = '';
	theHTML += '<table><tr>';
	theHTML += '<td cellspacing="0"><a href="../nl/"><img src="../resources/image/flag/flag_nl.gif" border="0"></a></td>';
	theHTML += '<td cellspacing="0"><a href="../en/"><img src="../resources/image/flag/flag_en.gif" border="0"></a></td>';
	theHTML += '</tr></table>';
	document.write( theHTML );
}

function multi_ShowFrame( aURL, aScrolling )
{
	var theHTML = '';
	theHTML += '<iframe id="text" width=550 height=300 frameborder=0 src="' + aURL + '" allowtransparency=true SCROLLING="' + aScrolling + '"></iframe>';
	document.write( theHTML );
}

function multi_CartItem( aItemName, aItemPrice) //, aShippingOne, aShippingMore )
{
	var theHTML = '';
	theHTML += '<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
	theHTML += '<input type="image" src="../resources/image/button/button_cart_add.gif" border="0" name="submit" alt="Make payments with PayPal - it\'s fast, free and secure!">';
	theHTML += '<input type="hidden" name="add" value="1">';
	theHTML += '<input type="hidden" name="cmd" value="_cart">';
	theHTML += '<input type="hidden" name="business" value="meeuwsen@natuurgeluiden.nl">';
	theHTML += '<input type="hidden" name="item_name" value="' + aItemName + '">';
	theHTML += '<input type="hidden" name="amount" value="' + aItemPrice + '">';
//	theHTML += '<input type="hidden" name="shipping" value="' + aShippingOne + '">';
//	theHTML += '<input type="hidden" name="shipping2" value="' + aShippingMore + '">';
	theHTML += '<input type="hidden" name="no_shipping" value="0">';
	theHTML += '<input type="hidden" name="no_note" value="0">';
	theHTML += '<input type="hidden" name="currency_code" value="EUR">';
	theHTML += '<input type="hidden" name="lc" value="US">';
	theHTML += '<input type="hidden" name="bn" value="PP-ShopCartBF">';
	theHTML += '</form>';
	document.write( theHTML );
}

function multi_CartView()
{
	var theHTML = '';
	theHTML += '<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
	theHTML += '<input type="hidden" name="cmd" value="_cart">';
	theHTML += '<input type="hidden" name="business" value="meeuwsen@natuurgeluiden.nl">';
	theHTML += '<input type="image" src="../resources/image/button/button_cart_view.gif" border="0" name="submit" alt="Make payments with PayPal - it\'s fast, free and secure!">';
	theHTML += '<input type="hidden" name="display" value="1">';
	theHTML += '</form>';
	document.write( theHTML );
}


/*********** BEGIN DWARSHUIS GEDEELTE *********************/

/* het creeren van external links die valideren als STRICT */
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";
}
}


/* opmaak van <hr />, dmv dynamische <div> er om heen, zie ook de css */
 function fancyRules() { 
  if (!document.getElementsByTagName) return; 
	  var hr = document.getElementsByTagName("hr");
  for (var i=0; i<hr.length; i++) { 
    var newhr = hr[i]; 
    var wrapdiv = document.createElement('div');
    wrapdiv.className = 'line';  
    newhr.parentNode.replaceChild(wrapdiv, newhr);  
    wrapdiv.appendChild(newhr);  
  } 
 } 
 
 
 /* combineren van meerder window.onload functies */
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

addLoadEvent(fancyRules);
addLoadEvent(externalLinks);


/*********** EIND DWARSHUIS GEDEELTE *********************/
