// trim function
function trim(value) {
	return value.replace(/^\s+|\s+$/,'');
};

// sendmail function
function sendMailTo(name, company, domain) {
   locationstring = 'mai' + 'lto:' + name + '@' + company + '.' + domain;
   window.location.replace(locationstring);
};


// menu function
function startList() {

	if (document.all&&document.getElementById) {
		navRoot = document.getElementById("nav");
		
		for (i=0; i<navRoot.childNodes.length; i++) {
				node = navRoot.childNodes[i];
				
				if (node.nodeName=="LI") {
					node.onmouseover=function() {
						this.className+=" over";
  					}

  					node.onmouseout=function() {
				  		this.className=this.className.replace(" over", "");
   					}
   				}
  		}
 	}
};

// preload images
function preloadImages(path) {

	img01 		= new Image();         
	img02 		= new Image();         
	img03 		= new Image();         
	img04 		= new Image();         
	img05 		= new Image();         
	img06 		= new Image();
	img07 		= new Image();
	img08 		= new Image();
	img09 		= new Image();         
	img10 		= new Image();
	img11 		= new Image();
	img12 		= new Image();
	img13 		= new Image();
	img14 		= new Image();
	img15 		= new Image();
	img16 		= new Image();
   
      
	img01.src	= path + "beschrijving_off.jpg";
	img02.src	= path + "beschrijving_act.jpg";
	img03.src	= path + "specs_off.jpg";
	img04.src	= path + "specs_act.jpg";
	img05.src	= path + "bestellen_off.jpg";
	img06.src	= path + "bestellen_act.jpg";
	img07.src	= path + "menubtn_off.gif";
	img08.src	= path + "menubtn_on.gif";
	img09.src	= path + "sub-menubtn_on.gif";
	img10.src	= path + "sub-menubtn_on.gif";
	img11.src	= path + "menubar.jpg";
	img12.src	= path + "searchbtn.gif";
	img13.src	= path + "home_icon_off.gif";
	img14.src	= path + "home_icon_on.gif";
	img15.src	= path + "itembar.jpg";
	img16.src	= path + "itembar_footer.gif";
};

// preload specific images
function preloadImage(imagePath) {
	img0 		= new Image();         
	img0.src	= imagePath;
};

// preview image function
function previewImage(unid,srcName) {
	var elem = document.getElementById(unid);
	elem.src = srcName;
};

// change tab function
function showTab(tabName, tabUNID) {
	var tabShow = document.getElementById(tabName + '_' + tabUNID);
	var tabHide1 = document.getElementById('order_' + tabUNID);
	var tabHide2 = document.getElementById('desc_' + tabUNID);
	var tabHide3 = document.getElementById('specs_' + tabUNID);
	tabHide1.style.display = 'none';
	tabHide2.style.display = 'none';
	tabHide3.style.display = 'none';
	tabShow.style.display = 'block';
};

// Create XML Http object (cross browser)
function GetXmlHttpObject() {
	var xmlHttp=null;
	try  {
	  // Firefox, Opera 8.0+, Safari
	  xmlHttp=new XMLHttpRequest();
	  } catch (e)  {
	  // Internet Explorer
	  try {
	    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
	    } catch (e) {
	    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	    }
	  }
return xmlHttp;
};

// Make call to agent
function makeAgentCall(agentURL) {
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)  {
		  ("Your browser does not support AJAX!");
		  return;
	} 
	
	xmlHttp.open("GET", agentURL, false);
	xmlHttp.send(null);

	var response = trim(xmlHttp.responseText);
	if (response == "OK") {
		// toon scherm
		alert("Succes");
	} else {
		alert("Helaas is er een fout opgetreden in het systeem. U kunt het beste contact met ons opnemen via support@aashq.nl. U kunt ons de volgende foutmelding meegeven: \n" + response);
	}
	
	
};