﻿//voorladen van de plaatjes

var foto1=new Image()
foto1.src="/images/banners/banner_13_chi_digitale_tang.jpg"// foto 1
var foto2=new Image()
foto2.src="/images/banners/banner_11_kerastase.jpg"// foto 2
var foto3=new Image()
foto3.src="/images/banners/banner_12_Instyleriron.jpg"// foto 3

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->

var stap=1
var beeldnr = 1

function overvloeier() {
    var o;

    o = getElementById_s('slide');
    if (o != null) {
        setOpacity(o, 0);
        o.src = eval("foto" + stap + ".src");
        fadeIn('slide', 0);
        beeldnr = stap
        if (stap < 3)// aanpassen aan aantal plaatjes
            stap++
        else
            stap = 1
        setTimeout("overvloeier()", 5000)// de tijd tussen twee plaatjes in milliseconden
    }
}

function overgang(){
if (beeldnr==1)
window.location="http://www.haarimport.nl/stijltangen/chi-farouk-stijltangen/chi-digital-ceramic-stijltang-art-14993.htm"
else if (beeldnr==2)
window.location="http://www.haarimport.nl/shampoos/kerastase-shampoos/kerastase-resistance-bain-age-recharge-250ml-art-14014.htm"
else if (beeldnr==3)
window.location="http://www.haarimport.nl/stijltangen/ultron-stijltangen/instyler-rotating-iron-art-14518.htm"
}

function setOpacity(obj, opacity) {
    opacity = (opacity == 100) ? 99.999 : opacity;

    // IE/Win
    obj.style.filter = "alpha(opacity:" + opacity + ")";

    // Safari<1.2, Konqueror
    obj.style.KHTMLOpacity = opacity / 100;

    // Older Mozilla and Firefox
    obj.style.MozOpacity = opacity / 100;

    // Safari 1.2, newer Firefox and Mozilla, CSS3
    obj.style.opacity = opacity / 100;
}

function fadeIn(objId, opacity) {
    if (document.getElementById) {
        obj = document.getElementById(objId);
        if (opacity <= 100) {
            setOpacity(obj, opacity);
            opacity += 100;
            window.setTimeout("fadeIn('" + objId + "'," + opacity + ")", 100);
        }
    }
}

function fadeOut(objId, opacity) {
    if (document.getElementById) {
        obj = document.getElementById(objId);
        if (opacity > 100) {
            setOpacity(obj, opacity);
            opacity -= 100;
            window.setTimeout("fadeOut('" + objId + "'," + opacity + ")", 100);
        } else {
            obj.className = 'hideimage';
        }
    }
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_showHideLayers() { //v9.0
  var i,p,v,obj, obj2,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { 
        obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; 
    }
    obj.visibility=v; }
}

function MM_changeProp(objId,x,theProp,theValue) { //v9.0
  var obj = null; with (document){ if (getElementById)
  obj = getElementById(objId); }
  if (obj){
    if (theValue == true || theValue == false)
      eval("obj.style."+theProp+"="+theValue);
    else eval("obj.style."+theProp+"='"+theValue+"'");
  }
}


function checkform()
{
var errorstr = ""
var emailstr = ""
if(document.frmtoevoegen.naam.value == "" )
	{errorstr = errorstr + "Er is geen naam ingevuld\n"}
if(document.frmtoevoegen.tekst.value == "")
	{errorstr = errorstr + "Er is geen ervaring ingevuld\n"}
if(document.frmtoevoegen.email.value == "")
	{errorstr = errorstr + "Er is geen email adres ingevuld\n"}
var str=document.frmtoevoegen.email.value
var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
if (filter.test(str))
	{emailstr = ""}
else
	{emailstr = "Er is geen geldig email adres ingevuld\n"}

if(errorstr != "" || emailstr != "")
	{alert("De volgende fouten zijn opgetreden\n\n" + errorstr + emailstr)}
else
	{
		document.frmtoevoegen.submit()
	}
}

	
function checkformreserve()
	{
	var errstr = ""
	if(document.formreserveren.naam.value == "")
		{errstr = errstr + "Naam is vereist\n"}
	if(document.formreserveren.email.value == "")
		{errstr = errstr + "Email is vereist\n"}
	else
		var str=document.formreserveren.email.value
		var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
		if (filter.test(str))
			{errstr = errstr + ""}
		else
			{errstr = errstr + "Een geldig email adres is vereist\n"}
	if(document.formreserveren.telefoon.value == "")
		{errstr = errstr + "Telefoon nummer is vereist\n"}
	if(errstr != "")
		{alert(errstr)}
	else
		{
		//alert("test")
		document.formreserveren.submit()
		}
	}
	
	
function PopupWindow(strURL,strName,strWidth,strHeight)
	{
	var hWindow;
	if (strWidth != '') {strWidth = 'width=' + strWidth ;}
	if (strHeight != '') {strHeight = 'Height=' + strHeight;} 
	hWindow = window.open(strURL , '', 'dependent=yes, hotkeys=no, titlebar=no, fullscreen=no, channelmode=no, toolbar=no, scrollbars=1, location=no, directories=no, status=no, menubars=no, resizable=no,' + strWidth + ', ' + strHeight + ', top=150, left=70');
	}


function enableField()
	{
		document.getElementById('btnSubmit').style.visibility = "hidden";
		document.getElementById('cboCountry').style.visibility = "hidden";
		document.getElementById('Betalingsmethode').style.visibility= "hidden";
		return true;
	}
function showinfo(objinfo)
{
	var obj;
	obj = document.getElementById(objinfo)
	var imgPosition;
	imgPosition = getElementPosition(obj);
	document.getElementById('libary').style.top= imgPosition.top; 
	document.getElementById('libary').style.left = imgPosition.left;
	document.getElementById('libary').style.visibility = "visible";
	document.getElementById('libary').innerHTML = '<a href="javascript:hideinfo();" class="textlink">Venster sluiten<img src="/images/no_s.gif" border=0></a><br><br>'; 
	document.getElementById('libary').innerHTML += obj.alt + '<br>';
	
	//setTimeout("hideinfo()", 15000);
}
document.write('<div id=libary class="libary"></div>');
function hideinfo()
{
	document.getElementById('libary').style.visibility = "hidden";
}

function getElementPosition(elem) {
    var offsetTrail = elem;
    var offsetLeft = 0;
    var offsetTop = 0;
    while (offsetTrail) {
        offsetLeft += offsetTrail.offsetLeft;
        offsetTop += offsetTrail.offsetTop;
        offsetTrail = offsetTrail.offsetParent;
    }
    if (navigator.userAgent.indexOf("Mac") != -1 && 
        typeof document.body.leftMargin != "undefined") {
        offsetLeft += document.body.leftMargin;
        offsetTop += document.body.topMargin;
    }
    return {left:offsetLeft, top:offsetTop};
}

function showPopup() {
  popImage(this.href,this.alt);
}

function activetab(tab)
{
    activetab1(tab);
    setTimeout("activetab1('" + tab + "')", 5);
}
function activetab1(tab)
{
    
	var intTeller;
	var obj;
	var strtab;

	intTeller = 1;
	
	strtab = 'tab' + intTeller;
	while (getElementById_s(strtab)!=null)
	{
		obj = getElementById_s(strtab);
		if (strtab == tab){
			obj.className = 'showtab';
			//obj = getElementById_s(strtab + '_h');
		    //obj.className = '1tabaktief';
		    //obj = getElementById_s(strtab + '_image');
		    //obj.src = '/images/' + strtab + '_ro.jpg';
		}else{
			obj.className = 'hiddentab';
			//obj = getElementById_s(strtab + '_h');
			//obj.className = '1tabgewoon';
			//obj = getElementById_s(strtab + '_image');
		    //obj.src = '/images/' + strtab + '.jpg';
		}
		intTeller++;
		strtab = 'tab' + intTeller;
	}
	
	intTeller = 1;
	
	strtab = 'tab' + intTeller;
	while (getElementById_s(strtab)!=null)
	{
		obj = getElementById_s(strtab);
		if (strtab == tab){
			//obj.className = 'showtab';
			//obj = getElementById_s(strtab + '_h');
		    //obj.className = '1tabaktief';
		    document.images[strtab + '_image'].src = '/images/' + strtab + '_ro.jpg';
		}else{
			//obj.className = 'hiddentab';
			//obj = getElementById_s(strtab + '_h');
			//obj.className = '1tabgewoon';
			//obj = getElementById_s(strtab + '_image');
		    document.images[strtab + '_image'].src = '/images/' + strtab + '.jpg';
		}
		intTeller++;
		strtab = 'tab' + intTeller;
	}
}

function getElementById_s(id){
	var obj = null;
	if(document.getElementById){
	/* Prefer the widely supported W3C DOM method, if
	available:-
	*/
	obj = document.getElementById(id);
	}else if(document.all){
	/* Branch to use document.all on document.all only
	browsers. Requires that IDs are unique to the page
	and do not coincide with NAME attributes on other
	elements:-
	*/
	obj = document.all[id];
	}
	/* If no appropriate element retrieval mechanism exists on
	this browser this function always returns null:-
	*/
	return obj;
}

//Load extern file in div
var loadedobjects=""
var rootdomain="http://"+window.location.hostname

function ajaxtabpage(url, containerid){
    ajaxpage(url,containerid);
    activetab(containerid);
}

function ajaxpage(url, containerid){
    document.getElementById(containerid).innerHTML = "<img src='/images/loading.gif' border=0>";
    var page_request = false;
    if (window.XMLHttpRequest){ // if Mozilla, Safari etc
    page_request = new XMLHttpRequest()}
    else if (window.ActiveXObject){ // if IE
    try {
    page_request = new ActiveXObject("Msxml2.XMLHTTP")
    } 
    catch (e){
    try{
    page_request = new ActiveXObject("Microsoft.XMLHTTP")
    }
    catch (e){}
    }
    }
    else
    return false
    page_request.onreadystatechange=function(){
    loadpage(page_request, containerid)
    }
    page_request.open('GET', url, true)
    page_request.send(null)
}

function loadpage(page_request, containerid){
    var rep;
    if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
    {
    rep = page_request.responseText;
    document.getElementById(containerid).innerHTML = "";
    document.getElementById(containerid).innerHTML =  "" + rep + "";
    }
}

function loadobjs(){
    if (!document.getElementById)
    return
    for (i=0; i<arguments.length; i++){
    var file=arguments[i]
    var fileref=""
    if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
    if (file.indexOf(".js")!=-1){ //If object is a js file
    fileref=document.createElement('script')
    fileref.setAttribute("type","text/javascript");
    fileref.setAttribute("src", file);
    }
    else if (file.indexOf(".css")!=-1){ //If object is a css file
    fileref=document.createElement("link")
    fileref.setAttribute("rel", "stylesheet");
    fileref.setAttribute("type", "text/css");
    fileref.setAttribute("href", file);
    }
    }
    if (fileref!=""){
    document.getElementsByTagName("head").item(0).appendChild(fileref)
    loadedobjects+=file+" " //Remember this object as being already added to page
    }
    }
}

function bestel(strNummer) 
{
    var strURL;
    strURL = '' + '/orderdefault.aspx?addtocart=' + strNummer;
    window.location.href =  strURL;
}


function contextmenu()
{
    return false;
}

//Begin functies voor category tekst
var dhtmlgoodies_slideSpeed = 90;	// Higher value = faster
var dhtmlgoodies_timer = 10;	// Lower value = faster

var objectIdToSlideDown = false;
var dhtmlgoodies_activeId = false;
var dhtmlgoodies_slideInProgress = false;
function showHideContent(e,inputId)
{
	if(dhtmlgoodies_slideInProgress)return;
	dhtmlgoodies_slideInProgress = true;
	if(!inputId)inputId = this.id;
	inputId = inputId + '';
	var numericId = inputId.replace(/[^0-9]/g,'');
	var answerDiv = document.getElementById('dhtmlgoodies_a' + numericId);

	objectIdToSlideDown = false;
	
	if(!answerDiv.style.display || answerDiv.style.display=='none'){		
		if(dhtmlgoodies_activeId &&  dhtmlgoodies_activeId!=numericId){			
			objectIdToSlideDown = numericId;
			slideContent(dhtmlgoodies_activeId,(dhtmlgoodies_slideSpeed*-1));
		}else{
			
			answerDiv.style.display='block';
			answerDiv.style.visibility = 'visible';
			
			slideContent(numericId,dhtmlgoodies_slideSpeed);
		}
	}else{
		slideContent(numericId,(dhtmlgoodies_slideSpeed*-1));
		dhtmlgoodies_activeId = false;
	}	
}

function slideContent(inputId,direction)
{
	
	var obj =document.getElementById('dhtmlgoodies_a' + inputId);
	var contentObj = document.getElementById('dhtmlgoodies_ac' + inputId);
	height = obj.clientHeight;
	if(height==0)height = obj.offsetHeight;
	height = height + direction;
	rerunFunction = true;
	if(height>contentObj.offsetHeight){
		height = contentObj.offsetHeight;
		rerunFunction = false;
	}
	if(height<=1){
		height = 1;
		rerunFunction = false;
	}

	obj.style.height = height + 'px';
	var topPos = height - contentObj.offsetHeight;
	if(topPos>0)topPos=0;
	contentObj.style.top = topPos + 'px';
	if(rerunFunction){
		setTimeout('slideContent(' + inputId + ',' + direction + ')',dhtmlgoodies_timer);
	}else{
		if(height<=1){
			obj.style.display='none'; 
			if(objectIdToSlideDown && objectIdToSlideDown!=inputId){
				document.getElementById('dhtmlgoodies_a' + objectIdToSlideDown).style.display='block';
				document.getElementById('dhtmlgoodies_a' + objectIdToSlideDown).style.visibility='visible';
				slideContent(objectIdToSlideDown,dhtmlgoodies_slideSpeed);				
			}else{
				dhtmlgoodies_slideInProgress = false;
			}
		}else{
			dhtmlgoodies_activeId = inputId;
			dhtmlgoodies_slideInProgress = false;
		}
	}
}

function initShowHideDivs()
{
	var divs = document.getElementsByTagName('DIV');
	var divCounter = 1;
	for(var no=0;no<divs.length;no++){
		if(divs[no].className=='meerinfobar'){
			divs[no].onclick = showHideContent;
			divs[no].id = 'dhtmlgoodies_q'+divCounter;
			var answer = divs[no].nextSibling;
			while(answer && answer.tagName!='DIV'){
				answer = answer.nextSibling;
			}
			answer.id = 'dhtmlgoodies_a'+divCounter;	
			contentDiv = answer.getElementsByTagName('DIV')[0];
			contentDiv.style.top = 0 - contentDiv.offsetHeight + 'px'; 	
			contentDiv.className='meerinfocontent_content';
			contentDiv.id = 'dhtmlgoodies_ac' + divCounter;
			answer.style.display='none';
			answer.style.height='1px';
			divCounter++;
		}		
	}
}

function initPage() {
    if (document.getElementById('loginbox') != null )
    {
        ajaxpage('/login.aspx','loginbox');
    }
    if (document.getElementById('right_nav_winkelmand') != null) {
        ajaxpage('/winkelmand.aspx', 'right_nav_winkelmand');
    }
    
    showhideImage();
}

var intCurrentImage;
intCurrentImage = 1;
intMaxImage = 4;

function showhideImage() {
    var strImage;
    var intTeller;
    var obj;
    var strCurrentImage;
    strCurrentImage = "productimage" + intCurrentImage;
    
    intTeller = 1;
    strImage = "productimage1";
    obj = getElementById_s(strImage);
    while (obj != null) {
        if (strImage == strCurrentImage) {
            obj.className = 'showimage';
        } else {
            obj.className = 'hideimage';
        }
        intTeller++;
        strImage = "productimage" + intTeller;
        obj = getElementById_s(strImage);
    }
    intMaxImage = intTeller - 1;
    if (intCurrentImage < intMaxImage) {
        intCurrentImage++;
    } else {
        intCurrentImage = 1;
    }
    setTimeout(showhideImage, 3000);
}

function Nieuwsbriefaanmelden(strNaam, strEmail) {

    if (document.getElementById("nieuwsbrief_naam").value != "Uw naam" && document.getElementById("nieuwsbrief_naam").value != "") {

        if (document.getElementById("nieuwsbrief_email").value != "Uw e-mail adres" && document.getElementById("nieuwsbrief_email").value != "")
        {
            ajaxpage('/nieuwsbriefaanmeld.aspx?naam=' + document.getElementById("nieuwsbrief_naam").value + '&email=' + document.getElementById("nieuwsbrief_email").value, 'nieuwsbrief');    
        }
    }
}

function Login(strNaam, strPass) {
    ajaxpage('/login.aspx?naam=' + strNaam + '&pass=' + strPass, 'loginbox');
}


