/*############################################################################*/
/*# Initialize */

function Main_Initialize()
{
  WHITE_AddEventToElement('countryButton', 'mouseover', showLanguageMenu);
  WHITE_AddEventToElement('countryButton', 'mouseout', hideLanguageMenu);
  WHITE_AddEventToElement('countryMenu', 'mouseover', showLanguageMenu);
  WHITE_AddEventToElement('countryMenu', 'mouseout', hideLanguageMenu);
}

function showLanguageMenu()
{
  var oElement = WHITE_GetElementFlex('countryMenu');
  WHITE_RemoveClassName(oElement,'hidden');
}

function hideLanguageMenu()
{
  var oElement = WHITE_GetElementFlex('countryMenu');
  WHITE_AddClassName(oElement,'hidden');
}

if ('function' == typeof WHITE_AddBodyLoadFunction)
{
  WHITE_AddBodyLoadFunction(Main_Initialize);
}

/*# /Initialize */
/*############################################################################*/


//########################################################
//# RANDOM IMAGE                                         #
//########################################################
photo = new Array();
photo[1] = new Array('monoblock',         4);
photo[2] = new Array('modular_pools',     4);
photo[3] = new Array('filtration',        4);
photo[4] = new Array('water_treatment',   4);
photo[5] = new Array('roldeck',           4);
var randomImage  = new Array();
var lastChanged = 0;

for (var i=1; i<photo.length; i++)
{
  var menuitem    = photo[i][0];
  var aantalfotos = photo[i][1];
  randomImage[i] = new Array();
  for (var j=0; j<aantalfotos; j++)
  {
    randomImage[i][j] = 'http://www.starlinepool.com/images/photo_' + menuitem + '_' + (j+1) + '.jpg';
  }
}


function ShowFlash(item, getvars)
{
  if (item == 'header') {
    document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="762" height="274">\n');
    document.write('  <param name="movie" value="http://www.starlinepool.com/flash/starline_header.swf' + getvars + '">\n');
    document.write('  <param name="quality" value="high">\n');
    document.write('  <param name="menu" value="false">\n');
    document.write('  <param name="wmode" value="transparent">\n');
    document.write('  <embed src="http://www.starlinepool.com/flash/starline_header.swf' + getvars + '" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="762" height="274" wmode="transparent"><\/embed>\n');
    document.write('<\/object>\n');
  }
}

function PopUpWindow(Wurl,Wname,Wtoolbar,Wlocation,Wdirectories,Wstatus,Wmenubar,Wscrollbars,Wresizable,Wcopyhistory,_width,_height)
{
  Wtop  = (document.body.clientHeight-_height)/2;
  Wleft = (document.body.clientWidth-_width)/2
  nw = window.open(Wurl,Wname,"height="+_height+",width="+_width+",top="+Wtop+",left="+Wleft+",resizable="+Wresizable+",scrollbars="+Wscrollbars+",toolbar="+Wtoolbar+",menubar="+Wmenubar+",location="+Wlocation+",status="+Wstatus+",directories="+Wdirectories);
}



//########################################################
//# PLACE MENU                                           #
//########################################################
function findpos(obj,name)
{
	var p = 0;
	var q = 0;
	var w = [ ];
	var w1 = "";
	while (obj.offsetParent)
	{
	 p += obj[name];
	 obj = obj.offsetParent;
	}
	return p;
}

function locatemenu()
{
	document.getElementById('menuholder2').style.top = findpos(document.getElementById('menuholder'), 'offsetTop') + 'px';
}

function preloader()
{
	for (var i=1; i<randomImage.length; i++)
	{
		for (var j=0; j<randomImage[i].length; j++)
		{
			document.write('<img src="' + randomImage[i][j] + '" width="1" height="1" style="display:none;">');
		}
  }
}

function ranNumber(menuitem)
{
	var ran_unrounded = Math.random()*(photo[menuitem][1]-1);
	var ran_number    = Math.round(ran_unrounded);
	return ran_number;
}

function changeimage(menuitem)
{
  if (lastChanged != menuitem)
  {
  	document.getElementById('photo').style.backgroundImage = "url('" + randomImage[menuitem][ranNumber(menuitem)] + "')";
  }
  lastChanged = menuitem;
}

function showtext(menuitem) {
  document.getElementById('introcontent'+menuitem).style.display = 'block';
}

function hidetext(menuitem) {
  document.getElementById('introcontent'+menuitem).style.display = 'none';
}

/*############################################################################*/
/*# Initialize */

function Sunglass_Initialize()
{
  //# Defined sizes for popupdiv types
  var aPopupDivSizes = new Array;
  aPopupDivSizes['popup'] = new Array;
  aPopupDivSizes['popup']['width'] = 752;
  aPopupDivSizes['popup']['height'] = 410;
  document['aPopupDivSizes'] = aPopupDivSizes;

  //# Create sunglassdiv and add onclick events
  if ('function' == typeof SUNGLASS_CreateSunglassPopup)
  {
    SUNGLASS_CreateSunglassPopup();
  }
  //# Create close popup links
  if ('function' == typeof SUNGLASS_InitClosePopupWindow)
  {
    SUNGLASS_InitClosePopupWindow();
  }
}



function HomePopupShow()
{
  Sunglass_Initialize();
  SUNGLASS_SunglassPopupShowType('http://www.starlinepool.com/de/de/popup.html','popup');
  //setTimeout('SUNGLASS_SunglassPopupHide();',5000);
}

/*# /Initialize */
/*############################################################################*/