//top navigation behavior
var nav2 = {};
var size = "";

nav2.mouseOver = function(obj) {
	if (obj != this.activeObj) { this.hide(); }
	clearTimeout(this.timeoutId);
	if (!this.activeObj) {
		if (obj.getElementsByTagName('DIV').length != 0) {
			this.menu = obj.getElementsByTagName('DIV')[0];
			this.menu.style.display = 'block';
		}
	}
	this.activeObj = obj;
} 

nav2.mouseOut = function(obj) {
	var obj = this;
	hide = function() { obj.hide(); }
	this.timeoutId = setTimeout('hide()', 300);
}

nav2.hide = function() {
	clearTimeout(this.timeoutId);
	if (this.activeObj) {
		if (this.menu) this.menu.style.display = 'none';
		this.activeObj = null;
	}
}
// Generate topnav
  function inserttopnav()
   {
    	//var code = "<div class=\'topdiv\'><a href=\'index.html\' id=\'home\' class=\'top\'>Home</a></div><div class=\'topdiv\' onmouseover=\'nav2.mouseOver(this);\' onmouseout=\'nav2.mouseOut(this);\'><a href=\'#\' class=\'top\' id=\'verkoop\'>Verkoop</a><div class=\'menu\' style=\'left:60px;\'><a href=\'http://retail.simstars.nl\' target=\'_blank\'>Groothandel</a></div></div><div class=\'topdiv\'><a href=\'contact.html\' id=\'contact\' class=\'top\'>Contact</a></div>"; 
    	var code = "<div class=\'topdiv\'><a href=\'index.html\' id=\'home\' class=\'top\'>Home</a></div><div class=\'topdiv\'><a href=\'contact.html\' id=\'contact\' class=\'top\'>Contact</a></div>"; 
       	var navdiv = document.getElementById("topnav");
    	navdiv.innerHTML = code;
   }

// Set width on 100% if windowwidth < 1024
function getBrowserWidth() {
	if (window.innerWidth)
		return window.innerWidth;
	else if (document.body.clientWidth)
		return document.body.clientWidth;
	else
		return 770;
}

function setMainWidth() {
	if (document.getElementById('container')) {
		var containerStyle = document.getElementById('container').style;
		var browserWidth = getBrowserWidth();
		var containerheight = document.getElementById('container').offsetHeight;
		document.getElementById('containerleft').style.height = containerheight + 'px';
		document.getElementById('containerright').style.height = containerheight + 'px';
		if (browserWidth > 1008) {
			if ((containerStyle.width != '') && (containerStyle.width != '1008px')) containerStyle.width = '1008px';			
		  //fm.createMovie('movie', '/flash/gallery.swf', 985, 385);
		} else if (browserWidth < 770) {
			containerStyle.width = '770px';
		} else {
			containerStyle.width = '100%';
		}
	}
	if (document.getElementById('footer')) {
		var footerStyle = document.getElementById('footer').style;
		var browserWidth = getBrowserWidth();
		if (browserWidth > 1008) {
			if ((footerStyle.width != '') && (footerStyle.width != '1008px')) footerStyle.width = '1008px';
		} else if (browserWidth < 770) {
			footerStyle.width = '770px';
		} else {
			footerStyle.width = '100%';
		}
	}
}

function doResize() {
	alert("doResize function called");
	//setMainWidth();
	//window.location = window.location;
}



function insertflashscript()
   {	 	
	   var browserWidth = getBrowserWidth();
		if (browserWidth > 1008) {
			if(size != "big") {
			  	var FO = { 
					movie:"flash/gallery.swf", 
					width:"952", 
					height:"385", 
					majorversion:"6", 
					build:"0",
					wmode: "opaque",
					bgcolor: "#DDDDDD"
				};		
				size = "big";
				
				UFO.create(FO, "flashcontent");		
			}
  		} else if (browserWidth < 770) {
			  if(size != "medium") {
				  var FO = { 
						movie:"flash/gallery_small.swf", 
						width:"720", 
						height:"290", 
						majorversion:"6", 
						build:"0",
						wmode: "opaque",
						bgcolor: "#DDDDDD"
					};
				size = "medium";
				
			UFO.create(FO, "flashcontent");		
			  }
		} else {
			  if(size != "small") {
			  var FO = { 
			movie:"flash/gallery_small.swf", 
			width:"720", 
			height:"290", 
			majorversion:"6", 
			build:"0",
			wmode: "opaque",
			bgcolor: "#DDDDDD"};
			size = "small";
			
			UFO.create(FO, "flashcontent");		
			}
		}		
		
   }
   
window.onload = function()
{
	insertflashscript();	
	setMainWidth(); 
}
   

