/* Mambo5 added functions */
var xmlhttp;

function aaGetXmlHttpRequest() {
   var xmlHttpObj;
   if (window.XMLHttpRequest) {
      xmlHttpObj = new XMLHttpRequest();
   } else {
      try
         {
            xmlHttpObj = new ActiveXObject("Msxml2.XMLHTTP");
         }
         catch (e)
         {
            try
            {
               xmlHttpObj = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e)
            {
               xmlHttpObj = false;
            }
         }
    }
    return xmlHttpObj;
}

var rockwell = {
	src: '/image/00041/swf/swf/vw_db.swf'
};

function activateSifr() {
	sIFR.useStyleCheck = true;
	sIFR.activate(rockwell);
	sIFR.replace(rockwell, {
		selector: 'p.price,p.price2,p.price3,h1.raprdPrice,h3.raprdPrice2,h3.raprdPrice3,.newRaprl .artBox .abBalloon p'
		,wmode: 'transparent'
		,css: [
			'.sIFR-root { text-align: center; font-weight: bold; color: #352171; }'
		]
	});
	
	sIFR.replace(rockwell, {
		selector: 'h5.ypTitle'
		,wmode: 'transparent'
		,css: [
			'.sIFR-root { text-align: left; letter-spacing: 0; font-weight: bold; color: #7CA0AC; }'
		]
	}); 
	
	sIFR.replace(rockwell, {
		selector: 'p.titleHead,h3.title, h1.aboTitle,h5.prFeature,h4.title'
		,wmode: 'transparent'
		,css: [
			'.sIFR-root { text-align: left; font-weight: bold; color: #352171; }'
		]
	});  
	
	sIFR.replace(rockwell, {
		selector: 'h3.pTitle'
		,wmode: 'transparent'
		,css: {
			'.sIFR-root': { 'color': '#352171', 'letter-spacing': 0 }
		}
	});

	sIFR.replace(rockwell, {
		selector: 'h4.accsifr'
		,wmode: 'transparent'
		,css: {
			'.sIFR-root': { 'color': '#ffffff', 'letter-spacing': 0 }
		}
	});
	
	sIFR.replace(rockwell, {
		selector: 'h3.cartTitle'
		,wmode: 'transparent'
		,css: [
			'.sIFR-root { text-align: center; font-size: 14px; letter-spacing: 0; font-weight: bold; color: #ffffff; background-color: #5C4E89; }'
		]
	});
	
	sIFR.replace(rockwell, {
		selector: 'h3.cartTitle2'
		,wmode: 'transparent'
		,css: [
			'.sIFR-root { text-align: right; letter-spacing: 0; color: #ffffff; background-color: #5C4E89; }'
		]
	});
	
	sIFR.replace(rockwell, {
		selector: 'div.m5subnav'
		,wmode: 'transparent'
		,css: [
			'.sIFR-root { text-align: left; margin: 0; color: #352171; }'
			,'a { text-decoration: none; font-size: 80px; }'
			,'a:link { color: #352171; }'
			,'a:hover { color: #5DCAFF; }'
		]
	});
	
	
	sIFR.replace(rockwell, {
		selector: 'h3.head'
		,wmode: 'transparent'
		,css: [
			'.sIFR-root { text-align: left; font-size: 24px; letter-spacing: 0; font-weight: bold; color: #352171; background: #000000; }'
		]
	});
	
	sIFR.replace(rockwell, {
		selector: 'h1.prodTitle,h1.aboHeader'
		,wmode: 'transparent'
		,css: [
			'.sIFR-root { text-align: left; color: #352171; }'
			,'a { text-decoration: none; }'
			,'a:link { color: #352171; }'
			,'a:hover { color: #352171; }'
		]
	});
}  

/*
 * jQuery Mambofive Function
 * version: 0.1 (2009-11-16)
 *
 * November 16, 2009: 
 * 
 */

if(typeof jQuery=="undefined"){throw"Unable to load the M5 Webservice library, jQuery library not found"}
(function($) {
	$.fn.m5login = function(options){	
		var defaults = {			
			domain: 'http://shop.www.hi.nl',
			showError: false
		}; 
		var options = $.extend(defaults, options);  
		var obj = $(this); 				

		
		// $.getJSON(options.domain+"/hivov/mcsmambo.p", function(jsonArray){
		//	sessionid = jsonArray.SESSION.pmuniq;
		//}); 
		
		$(this).live("submit",function(e) {
			e.preventDefault();
			obj = $(this);

			jsonString = 'jsonrequest={"form":'+$.toJSON($(this).serializeArray(),1,0)+'}';
			$.ajax({
				type: "GET",
			   	url: options.domain+"/hivov/mcsmambo.p?M5NextUrl=MKHRMREG&objectType=AJAX",
			   	data: jsonString,
			   	dataType: "json",
			   	success: function(text){
					if($('.regInput').css("border","solid 1px #ff0000")) $('.regInput').css("border", "solid 1px #D7D7EA");
					if(!text.mkhrmreg.pmErrorNo){
						try {
							location = options.domain+'/hivov/mcsmambo.p'; 
						}catch(e){
							if(options.showError === true ){
								var pmError = text.mkhrmreg.pmErrorField.split(',');
								for(var i=0;i<pmError.length;i++) {
									$('#'+pmError[i]).css("border","solid 1px #ff0000");
								}
							}	
						}
					}else{
						if(options.showError === true ){
							var pmError = text.mkhrmreg.pmErrorField.split(',');
							for(var i=0;i<pmError.length;i++) {
								$('#'+pmError[i]).css("border","solid 1px #ff0000");
							}
						}	
					}
				}
			});
		});
		$('[name=logout]').live("click", function(){
			$.getJSON(options.domain+"/hivov/mcsmambo.p?M5NextUrl=LOGOUT&objectType=AJAX&callback=?", function(jsonArray){
				obj.show();
				$('.user').hide();
			});
		});
	};
	$.m5form2url = function(url, formname, object){
		var formdata = $.toJSON($("form[name='"+formname+"']").serializeArray(),1,0);
		document.location.href = url + "&"+object+"="+ formdata ;
	};
	$("a.lastMinute").css("cursor","pointer");
})(jQuery);  



// get Data using Ajax // Do not change
function getData(selfUrl) {
   if (!xmlhttp) xmlhttp = aaGetXmlHttpRequest();
   if (!xmlhttp) return;
	var target = '';
	var CMT = '';
	var adhnr = '';
	if(document.cntFrm) {
 		target = encodeURIComponent(document.cntFrm.zip_id.value);
		CMT = document.cntFrm.M5WebChoice.value;
		adhnr = document.cntFrm.cust_adhnr.value;
	}
   var qry = "zip_id=" + target;	
	var url = selfUrl + '?M5NextUrl=ADCEN&objectType=AJAX&cust_adhnr=' + adhnr + '&' + qry;
   xmlhttp.open('GET', url, true);
   xmlhttp.onreadystatechange = printData;
   xmlhttp.send(null);
}

// Functie voor het visualiseren van postcode resultaat
function printData() {
	if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
      var resultStr = xmlhttp.responseText;
		var strsub = '***';
		var street = resultStr.split(strsub);
		var m5zip = street[1];
		var m5street = street[2];
		var m5city = street[3];
		if(document.cntFrm.cust_adhnr.value.length == 0) {
		} else if(m5street.length <= 1) {
			if(document.getElementById('m5ajxbox')) document.getElementById('m5ajxbox').style.display = 'none';
			if(document.getElementById('m5ajxbox')) document.getElementById('m5ajxbox').style.visibility = 'hidden';
			if(document.getElementById('m5zip')) document.getElementById('m5zip').className = 'error';
			if(document.getElementById('m5adhnr')) document.getElementById('m5adhnr').className = 'error';
		} else {
			if(document.getElementById('m5ajxbox')) document.getElementById('m5ajxbox').style.display = 'block';
			if(document.getElementById('m5ajxbox')) document.getElementById('m5ajxbox').style.visibility = 'visible';
			if(document.cntFrm) document.cntFrm.zip_id.value = m5zip;
			if(document.getElementById('ziperrortxt') && document.getElementById('ziperrortxt') != "") {
				document.getElementById('ziperrortxt').style.display = 'none';
				document.getElementById('ziperrortxt').style.visibility = 'hidden';
			}
			if(document.getElementById('m5streetname')) document.getElementById('m5streetname').innerHTML = m5street + ' ' + document.cntFrm.cust_adhnr.value + document.cntFrm.cust_adext.value ;
			if(document.getElementById('m5cityname')) document.getElementById('m5cityname').innerHTML = m5zip + ' ' + m5city;
			if(document.getElementById('m5zip')) document.getElementById('m5zip').className = 'odd';
			if(document.getElementById('m5adhnr')) document.getElementById('m5adhnr').className = '';
			if(document.cntFrm) document.cntFrm.cust_adstr.value = m5street;
			if(document.cntFrm) document.cntFrm.cust_city.value = m5city;	
		}
   }
}

function addEvent( obj, type, fn ) {
  if ( obj.attachEvent ) {
    obj['e'+type+fn] = fn;
    obj[type+fn] = function(){obj['e'+type+fn]( window.event );}
    obj.attachEvent( 'on'+type, obj[type+fn] );
  } else
    obj.addEventListener( type, fn, false );
}
function removeEvent( obj, type, fn ) {
  if ( obj.detachEvent ) {
    obj.detachEvent( 'on'+type, obj[type+fn] );
    obj[type+fn] = null;
  } else
    obj.removeEventListener( type, fn, false );
}		 

function setVisible(obj){
	obj = document.getElementById(obj);
	if(obj) {
		obj.style.visibility = (obj.style.visibility == 'visible') ? 'hidden' : 'visible';
		obj.style.display = (obj.style.display == 'block') ? 'none' : 'block';
	}
}

function setInvisible(obj){
	obj = document.getElementById(obj);
	if(obj) {
		obj.style.visibility = (obj.style.visibility == 'hidden') ? 'visible' : 'hidden';
		obj.style.display = (obj.style.display == 'none') ? 'block' : 'none';
	}
}

function switchVisibility(tar,behavior) {
	if(tar) {
		obj = document.getElementById(tar);
 	   if(obj) {
			if(behavior && behavior == 1) {
				obj.style.display = 'block';
				obj.style.visibility = 'visible';
			} else {
				obj.style.display = 'none';
				obj.style.visibility = 'hidden';
			}
		}
	}
}

function getTab(nr){
	if (document.getElementById('tabLink'+nr) && document.getElementById('tabLink'+nr) != null) {
		if(document.getElementById('tabLink1')) document.getElementById('tabLink1').className = 'reviews'; 
		if(document.getElementById('tabLink2')) document.getElementById('tabLink2').className = 'extras'; 
		if(document.getElementById('tabLink3')) document.getElementById('tabLink3').className = 'specificaties'; 
	}

	if (document.getElementById('Tab'+nr) && document.getElementById('Tab'+nr) != null) {
		var tab = '';
		var tab2 = '';
		if(document.getElementById('Tab1')) document.getElementById('Tab1').style.display = 'none'; document.getElementById('Tab1').style.visibility = 'hidden'; 
		if(document.getElementById('Tab2')) document.getElementById('Tab2').style.display = 'none'; document.getElementById('Tab2').style.visibility = 'hidden'; 
		if(document.getElementById('Tab3')) document.getElementById('Tab3').style.display = 'none'; document.getElementById('Tab3').style.visibility = 'hidden';

		if(document.getElementById('Tab'+nr)) {
			tab = document.getElementById('Tab'+nr);
			tab.style.display = 'block';
			tab.style.visibility = 'visible';
		}
		if(document.getElementById('tabLink'+nr)) {
	 		tab2 = document.getElementById('tabLink'+nr);
			tab2.className = tab2.className+'_active';
		}
	}
}

function displayswitch(elm) {
	obj = document.getElementById(elm);
	if (obj) {
		if (obj.style.display == 'block') obj.style.display = 'none';
    	else obj.style.display = 'block';
	}
	return true;
}

function openAboList(ca_id) {
	if(ca_id) {
		$('.aboTab').fadeOut(400);
		setTimeout(function() {
			$('#aboTab_' + ca_id).fadeIn(400);
			if($('#hide_' + ca_id).val() == '1') {
				$('#aboOptions').fadeOut(800);
			} else {
				$('#aboOptions').fadeIn(800);
			}		  
		}, 400);
	}
}

function openpopup(naam, framenaam, breedte, hoogte) {
	eigenschappen = "'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,screenX=50,screenY=50,resizable=yes,width=" + breedte + ",height=" + hoogte +"'";
	window.open(naam, framenaam, eigenschappen);
}

function setShopMenu(action){
	if(document.getElementById('slideMenuItems')) {
		if(action == "show") {
			document.getElementById('slideMenuItems').style.display = 'block';
			document.getElementById('slideMenuItems').style.visibility = 'visible';
		} else {
			document.getElementById('slideMenuItems').style.display = 'none';
			document.getElementById('slideMenuItems').style.visibility = 'hidden';
		}
	}
}

function setRadio(target,value) {
	document.getElementById(target+'_check').value = value;
}

function setBlurs(value, selfUrl) {
	var returnString = "abo_ollnr,abo_olsub,abo_type,lb_id_check,cust_fname,cust_name,cust_byear,cust_bmonth,cust_bday,cust_bday,cust_adstr,cust_adhnr,cust_adext,zip_id,cust_city,cust_idtype,cust_idnr,pmu_id";
	var returnCheck = returnString.split(',');
	if(value == 1) {
		for(var i=0;i<returnCheck.length;i++) {
			if(document.getElementById(returnCheck[i])) addEvent(document.getElementById(returnCheck[i]),"blur",function() { getKam(selfUrl) });
		}
	} else {
		for(var i=0;i<returnCheck.length;i++) {
			if(document.getElementById(returnCheck[i])) removeEvent(document.getElementById(returnCheck[i]),"blur",function() { getKam(selfUrl) });
		}
	}
}

function validateId(selfUrl) {
    var cust_idnr = '';
    var cust_idtype = '';
    var validId = '';
    if(document.getElementById('cust_idnr') && document.getElementById('cust_idtype') && document.getElementById('validID')) {
        cust_idnr = $('#cust_idnr').val();
        cust_idtype = $('#cust_idtype').val();
        if(cust_idnr && cust_idtype) {
            var stUrl = selfUrl + '?M5NextUrl=mkhaboc1&objectType=HTML&cust_idtype='+cust_idtype+'&cust_idnr='+cust_idnr;
            $.ajax({
                url: stUrl,
                cache: false,
                success: function(html){
                    var resultStr = html;
                    resultStr = resultStr.split('***');
                    if(resultStr[1]) {
                        $('#validID').val(resultStr[1]);
                        if(resultStr[1] != 'OK') {
                            $('#m5idnr').addClass('error');
                            $('#m5idtype').addClass('error');    
                        } else if(resultStr[1] == 'OK') {
                            $('#m5idnr').removeClass('error');
                            $('#m5idtype').removeClass('error');   
                        }
                    }
                }
            });     
        } 
    }    
}

// Ajax KAMCHECK -- Do not change
function getKam(selfUrl) {
	// Check of alle velden zijn ingevuld, zo nee - welke niet 
	var testTot = "";
	if(document.getElementById('validID')) var validId = document.getElementById('validID').value;
	var returnString = "abo_ollnr,abo_olsub,abo_type,lb_id_check,cust_fname,cust_name,cust_prefix,cust_byear,cust_bmonth,cust_bday,cust_adstr,cust_adhnr,cust_adext,zip_id,cust_city,cust_idtype,cust_idnr,pmu_id";
	var returnCheck = returnString.split(',');
	for(var i=0;i<returnCheck.length;i++) {
		if((document.getElementById(returnCheck[i]).value == "" || document.getElementById(returnCheck[i]).value == "_") && returnCheck[i] != "cust_adext" && returnCheck[i] != "cust_prefix"){
			testTot = testTot + returnCheck[i] + ", ";
		}
	} 
    if(testTot == "" && validId == 'OK') { /* CASE: Alle velden zijn ingevuld */	
        var pmshop = document.getElementById('KAM_pmshop').value;
        if (!xmlhttp) xmlhttp = aaGetXmlHttpRequest();
        if (!xmlhttp) return;
        var CMT = document.cntFrm.M5WebChoice.value;
        var abo_ollnr = document.cntFrm.abo_ollnr.value;
		var abo_olsub = document.cntFrm.abo_olsub.value;
		var abo_type = document.cntFrm.abo_type.value;
		var lb_id = document.cntFrm.lb_id_check.value;
		var cust_fname = encodeURIComponent(document.cntFrm.cust_fname.value);
		var cust_name = encodeURIComponent(document.cntFrm.cust_name.value);
		var cust_prefix = encodeURIComponent(document.cntFrm.cust_prefix.value);
		var cust_byear = document.cntFrm.cust_byear.value;
		var cust_bmonth = document.cntFrm.cust_bmonth.value;
		var cust_bday = document.cntFrm.cust_bday.value;
		var cust_adstr = encodeURIComponent(document.cntFrm.cust_adstr.value);
		var cust_adhnr = encodeURIComponent(document.cntFrm.cust_adhnr.value);
		var cust_adext = encodeURIComponent(document.cntFrm.cust_adext.value);
		var zip_id = encodeURIComponent(document.cntFrm.zip_id.value);
		var cust_city = encodeURIComponent(document.cntFrm.cust_city.value);
		var cust_idtype = encodeURIComponent(document.cntFrm.cust_idtype.value);
		var cust_idnr = encodeURIComponent(document.cntFrm.cust_idnr.value);
		var pmu_id = document.cntFrm.pmu_id.value;
		
		// Activeer AJAX KAMCHECK
		var addString = 'M5WebChoice='+CMT+'&abo_ollnr='+abo_ollnr+'&abo_olsub='+abo_olsub+'&abo_type='+abo_type+'&lb_id='+lb_id+'&cust_fname='+cust_fname+'&cust_name='+cust_name+'&cust_prefix='+cust_prefix+'&cust_byear='+cust_byear+'&cust_bmonth='+cust_bmonth+'&cust_bday='+cust_bday+'&cust_adstr='+cust_adstr+'&cust_adhnr='+cust_adhnr+'&cust_adext='+cust_adext+'&zip_id='+zip_id+'&cust_city='+cust_city+'&cust_idtype='+cust_idtype+'&cust_idnr='+cust_idnr+'&pmu_id='+pmu_id;
		var url = selfUrl+'?M5NextUrl=mkhkamc1&objectType=AJAX&'+addString;
		// setBlurs(0);
		setVisible('ajaxKam');
		document.getElementById('kamBody').innerHTML = '<div style="padding: 0 2px; text-align: center;">'+document.getElementById('checkResults').innerHTML+'</div>';		
		xmlhttp.open('GET', url, true);
        xmlhttp.onreadystatechange = printKam;
        xmlhttp.send(null);
	} else { /* CASE: Nog niet alle velden zijn ingevuld */
		document.getElementById('kamBody').innerHTML = testTot;		
	}
}

// KAM RETURN
function printKam() { 
	if(!xmlhttp.readyState == 4) {
	} else if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
      var resultStr = xmlhttp.responseText;
		var defResult = resultStr.split('***');
		document.cntFrm.kamid.value = defResult[2];
		if(defResult[1] == "OK") {	
			setInvisible('kamC2');
			setVisible('kamC1');
			// setVisible('M5SButton');
			setBlurs(0);
			document.getElementById('kamBody').innerHTML	= document.getElementById('kamreg1').innerHTML + '<div class="clear"></div>';
		} else {
			document.getElementById('kamBody').innerHTML	= document.getElementById('kamreg0').innerHTML + '<div class="clear"></div>';
		}
		document.getElementById('kamtest').innerHTML= '<div style="padding: 0 2px; text-align: center;">' + defResult[3] + '</div>';
		var returned = defResult[2].substring(2,4);
		// document.getElementById('thisKamError').href = document.getElementById('thisKamError').href + '4' + returned;
		document.getElementById('thisKamError2').href = document.getElementById('thisShop').value + '/hi/mcsmambo.p?M5NextUrl=RAINF&M5Arg=4' + returned;
   }	
}

function fillM5SData() {	
	if(document.getElementById('KAM_pmshop').value != "hiwl") {
		var title1 = document.getElementById('cartPr1').title;
		var titleTotal = '<div class="inCart tstTitle">' + title1 + '</div>';
		document.getElementById('cartContainer2').innerHTML = titleTotal + document.getElementById('cartDetails').innerHTML;
	}
	var sex = "Mevrouw";
	if(document.cntFrm.lb_id_check && document.cntFrm.lb_id_check.value == "M") sex = "De heer";
	document.getElementById('M5SD_Name').innerHTML = sex+' '+document.cntFrm.cust_fname.value+' '+document.cntFrm.cust_name.value;
	document.getElementById('M5SD_Adr').innerHTML = document.cntFrm.cust_adstr.value+' '+document.cntFrm.cust_adhnr.value+document.cntFrm.cust_adext.value;

	document.getElementById('M5SD_Zip').innerHTML = document.cntFrm.zip_id.value;
	document.getElementById('M5SD_City').innerHTML = document.cntFrm.cust_city.value;

	if(document.cntFrm.cust_bday && document.cntFrm.cust_bmonth && document.cntFrm.cust_byear) {
		if(document.cntFrm.cust_bday.value != '' && document.cntFrm.cust_bmonth.value != '' && document.cntFrm.cust_byear.value != '') {
			document.getElementById('M5SD_Bday').innerHTML = document.cntFrm.cust_bday.value + ' / ' + document.cntFrm.cust_bmonth.value + ' / ' + document.cntFrm.cust_byear.value;
		} else {
			document.getElementById('M5SD_Bday').innerHTML = 'Niet juist ingevuld';
		}
	}

	document.getElementById('M5SD_Tel').innerHTML = document.cntFrm.cust_tel.value;

	if(document.cntFrm.pmu_id) { 
		document.getElementById('M5SD_Email').innerHTML = document.cntFrm.pmu_id.value; } 
	else if(document.cntFrm.cust_email) {
		document.getElementById('M5SD_Email').innerHTML = document.cntFrm.cust_email.value;
	}
	document.getElementById('M5SD_IDType').innerHTML = document.cntFrm.cust_idtype.options[document.cntFrm.cust_idtype.selectedIndex].text;
	document.getElementById('M5SD_IDNR').innerHTML = document.cntFrm.cust_idnr.value;
	if(document.cntFrm.cust_ccname) { document.getElementById('M5SD_CCRek').innerHTML = document.cntFrm.cust_ccname.value; }
	if(document.cntFrm.cust_bank) { document.getElementById('M5SD_CCNR').innerHTML = document.cntFrm.cust_bank.value; }

	if(document.getElementById('KAM_pmshop').value != "hiwl") {
		if(document.cntFrm.TNTPS_naam && document.cntFrm.TNTPS_naam.value != "") {
			document.getElementById('M5SD_Adr2').innerHTML = document.cntFrm.TNTPS_naam.value;
		} else if(document.cntFrm.cust_adstr && document.cntFrm.cust_adstr != '') {
			document.getElementById('M5SD_Adr2').innerHTML = document.cntFrm.cust_adstr.value+' '+document.cntFrm.cust_adhnr.value+document.cntFrm.cust_adext.value+' '+document.cntFrm.cust_city.value;
		} else {
		   document.getElementById('M5SD_Adr2').innerHTML = 'Nog niet ingevuld'; 
		}
	} else { document.getElementById('M5SD_Adr2').innerHTML = document.cntFrm.cust_adstr.value+' '+document.cntFrm.cust_adhnr.value+document.cntFrm.cust_adext.value+' '+document.cntFrm.cust_city.value; }
	
	if(document.cntFrm.zekermob_check && document.cntFrm.zekermob_check.value == "TRUE") {  
		document.getElementById('M5SD_Zekermob').innerHTML = "U heeft gekozen voor een mobiele verzekering";
	} else {	document.getElementById('M5SD_Zekermob').innerHTML = "U heeft niet gekozen voor een mobiele verzekering"; }		
}

function prActivate(target,product,shop) {
	for(var i=1;i<7;i++) {
		if(document.getElementById('prBox'+i)) document.getElementById('prBox'+i).className = 'prBox';
	}
	if(document.getElementById(target)) document.getElementById(target).className = 'prBox active';
	getRAPRD(product,shop);
}

function getRAPRD(product,shop,evnt) {
   if (!xmlhttp) xmlhttp = aaGetXmlHttpRequest();
   if (!xmlhttp) return;
	var url = '/'+shop+'/mcsmambo.p?M5NextUrl=RAPRD&art_id='+product+'&objectType=HTML';
	if(document.getElementById('prLoadingFrame')) {
		document.getElementById('prLoadingFrame').style.visibility = 'visible';
		document.getElementById('prLoadingFrame').style.display = 'block';
	}
    xmlhttp.open('GET', url, true);
    xmlhttp.onreadystatechange = printRAPRD;
    xmlhttp.send(null);
}

// Functie voor het visualiseren van postcode resultaat
function printRAPRD() {
    if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
      var resultStr = xmlhttp.responseText;
		var result = resultStr.split("*****");
		if(result.length != 1) {
			if(document.getElementById('prIC')) document.getElementById('prIC').innerHTML = result[1];
			if(document.getElementById('promoDesc')) document.getElementById('promoDesc').innerHTML = result[2];
			if(document.getElementById('promoFeat')) document.getElementById('promoFeat').innerHTML = result[3];
			if(document.getElementById('prUrl')) document.getElementById('prUrl').href = result[4];
			if(document.getElementById('priceTag')) document.getElementById('priceTag').innerHTML = result[5];
		}
	   if(document.getElementById('prLoadingFrame')) {
			document.getElementById('prLoadingFrame').style.visibility = 'hidden';
			document.getElementById('prLoadingFrame').style.display = 'none';
		}
		sIFR.replace(rockwell, {
			selector: 'h3.pTitle'
				,wmode: 'transparent'
				,css: {
				'.sIFR-root': { 'color': '#352171', 'letter-spacing': 0 }
			}
		});
		sIFR.replace(rockwell, {
	    selector: 'h5.prFeature'
		 ,wmode: 'transparent'
	    ,css: [
	      '.sIFR-root { text-align: left; font-weight: bold; color: #352171; }'
	    ]
		});
		sIFR.replace(rockwell, {
		selector: 'p.price'
		,wmode: 'transparent'
		,css: [
			'.sIFR-root { text-align: center; font-weight: bold; color: #352171; }'
			,'a { text-decoration: none; }'
			,'a:link { color: #352171; }'
			,'a:hover { color: #352171; }'
		]
	});
   }
}

function setLights() {
	var shot = document.getElementsByTagName('tr');
	for(var i=0;i<shot.length;i++) {
		if(shot[i].className == "odd" || shot[i].className == "even" || shot[i].className == "tblHover") {
			if(shot[i].id.substring(0,5) == "abotr") {
				/* Event(shot[i],"click",function(){ location = document.getElementById('abohref'+this.id.substring(5,8)).href; }); */
				addEvent(shot[i],"mouseout",function(){ if(this.className.substring(0,3) == "odd") { this.className = "odd"; } else if(this.className.substring(0,3) == "tbl") { this.className = "tblHover"; } else { this.className = "even"; } });
				addEvent(shot[i],"mouseover",function(){ if(this.className.substring(0,3) != "tbl") { this.className = this.className + " tblHover"; } });
			}
		}
	}
}
  
function setImage(picture, activate) {
	document.getElementById('varimage').src = picture;
	var thumbs = parseInt(document.getElementById('tCount').value);
	thumbs += 1;
	for(var i=1;i<thumbs;i++) {
		document.getElementById('imgThumb'+i).className = 'imgBox';
	}
	document.getElementById(activate).className = 'imgBox active';
}

function fillTables() {
    $(document).ready(function() {
        var color = '';
        $('tr').each(function() {
            if(color == 'odd') color = 'even'; else color = 'odd';
            $(this).addClass(color);
        });
    });
}

function showConFeatures() {
	setInvisible('dimContainer');
	setVisible('dimmer');
	setVisible('dimContent');
	setVisible('dimInfo');	
	var desc = 'Waardering_1,Uitrusting,Waardering_2,Gebruiksgemak,Waardering_3,Prijskwaliteit,Waardering_4,Eindoordeel';
	desc = desc.split(',');
	var content = document.getElementById('con_Inleiding').innerHTML;
   for(var i=0;i<8;i++) {
		if(document.getElementById('con_'+desc[i])) {
			content += document.getElementById('con_'+desc[i]).innerHTML; 
		}
	}
	if(document.getElementById('con_Foto')) { content += document.getElementById('con_Foto').innerHTML; } 
	document.getElementById('dimInfo').innerHTML = '<div class="dimCon"><div class="dimInfoInner2"><a id="dimCloser" onClick="closeDimmer(5);"><img src="/image/00041/hiv2/inlinepopup/close.gif" alt="Sluit" /></a><p class="helpTitle">Expert review</p>'+content+'</div></div>';
	sIFR.replace(rockwell, {
		selector: 'p.helpTitle'
		,wmode: 'transparent'
		,css: [
		'.sIFR-root { text-align: left; font-weight: bold; color: #352171; }'
		]
	});  
}

function checkKC(target, obj, exception) {
	if(obj == 'radio') {
		if(document.getElementById(target).checked != true) {
			displayswitch('keepcel_number'); 
			document.getElementById('nummerbehoud').style.display= 'none'; 
			document.getElementById(target).checked = true;
			if(exception == 'off') {
				document.getElementById('kcCheck').checked = false; 
			}
		} 
	}
   if(obj == 'checkbox') {
		if(document.getElementById(target).selected != true) {
			displayswitch('nummerbehoud'); 
			document.getElementById(target).selected = true;
		} else { 
			document.getElementById(target).selected = false; 
			displayswitch('nummerbehoud');
		}
	}
}					 
	
function prCompare(art_id, artSrc) {
	var abo_id = '';
	var abo_options = '';
	if(document.getElementById('abo_id')) abo_id = document.getElementById('abo_id').value;
	if(document.getElementById('abo_options')) abo_options = document.getElementById('abo_options').value;
	var inputs = document.srchFrm.getElementsByTagName('input');
	var prAdd = true;
	var action = '';
	var sessId = '';
	var prSession = 0;
	var inSession = false;
	if(art_id && art_id != 'noArt') {
		for(var x=0;x<inputs.length;x++) {
			if(inputs[x].name.substring(0,2) == 'id') {
				if(inputs[x].value == art_id) { prAdd = false; }
			}
		}
		for(var i=0;i<inputs.length;i++) {
			if(inputs[i].name.substring(0,2) == 'id') {
				var iName = inputs[i].name.substring(2,99);
				if(inputs[i].value == art_id) {
					inputs[i].value = '';
					$('#tst'+iName).fadeOut(400);
					$('#cmp_'+art_id).removeClass('cbActive');
					action = 'removed';
				} else if(inputs[i].value == '' && prAdd == true && inSession == false) {
				 	inputs[i].value = art_id;
					$('#tst'+iName).html('<img src="'+artSrc+'" alt="" /><a onClick="prDelete(\''+iName+'\',\''+art_id+'\')">verwijder</a>');
					$('#tst'+iName).fadeIn();
					$('#cmp_'+art_id).addClass('cbActive');
					action = 'added';
					inSession = true;
				} 
			}
		}
		if(action == '') alert('Je hebt al 3 toestellen geselecteerd'); 
	}
	for(var z=0;z<inputs.length;z++) {
		if(inputs[z].name.substring(0,2) == 'id' && inputs[z].value != '') {
			sessId += inputs[z].value + ',';
			prSession += 1;
		}
	}
	if(prSession >= 1) {
		if(prSession == 1) $('#cmpTst').fadeIn();
		if(prSession == 2 || prSession == 3) {
			sessId = sessId.split(',');
			$('.doCompare').attr('class','doCompare dcActive');
			$('.doCompare').attr('href','/'+document.srchFrm.pmshop.value+'/mcsmambo.p?M5NextUrl=RACMP&id1='+sessId[0]+'&id2='+sessId[1]+'&id3='+sessId[2]+'&abo_id='+abo_id+'&abo_options='+abo_options);
			$('#allCompare').fadeIn();
		} else {
			$('.doCompare').attr('class','doCompare');
		   $('.doCompare').attr('href','#');
			$('#allCompare').fadeOut();
		}
	} else $('#cmpTst').fadeOut();
}

function prDelete(iVar,art_id) {
	var prSession = 0;
	$('#tst'+iVar).fadeOut();
	$('#cmp_'+art_id).attr('class','compareBtn');
	$('#id'+iVar).val('');
	for(var i=1;i<=3;i++) {
		if($('#id'+i).val() != '') prSession += 1; 
	}
	if(prSession<=1) {
	   $('.doCompare').attr('class','doCompare');
		$('.doCompare').attr('href','#');
   	$('#allCompare').fadeOut();
	}
	if(prSession == 0) $('#cmpTst').fadeOut();
}

function flushForm(tar) {
	var fields = document.getElementById(tar).getElementsByTagName('input');
	for(var i=0;i<fields.length;i++) {
		if(fields[i].type == 'hidden' && fields[i].name != 'M5CurrUrl' && fields[i].name != 'M5NextUrl' && fields[i].name != 'ab_agid') {
			fields[i].value = '';
		}
	}
}

function addVar(tar,clr) {
	var cList = '';
	if(document.getElementById(tar)) cList = document.getElementById(tar).value;
	var addClr = true;
	var newList = '';
	if(cList == '') {
		document.getElementById(tar).value = clr;
	} else {
		cList = cList.split(',');
		for(var i=0;i<cList.length;i++) {
			if(cList[i] == clr) {
				addClr = false;
			} else {
				if(i == 0) {
					newList = cList[i];
				} else {
					newList += ','+cList[i];
				}
			}
		}
		if(addClr == true) {
			document.getElementById(tar).value += ','+clr;
		} else {
		  document.getElementById(tar).value = newList;
		}
	}
}

function accSelect(sel,selid) {
	var clear = 'tst_supp,acc_cat,acc_supp,art_id,ab_agid';
	clear = clear.split(',');
	if(document.provSelect) {
		for(var i=0;i<clear.length;i++) {
			if(document.getElementById(clear[i]) && clear[i] != sel) {
				document.getElementById(clear[i]).value = '';
			} else if(document.getElementById(clear[i])) {
				document.getElementById(clear[i]).value = selid;
			}
		}
	}
}

function buildObject(s,t) {
	var holder = document.getElementById('objectHolder');
	if(holder) {
		if(t && t == 'img') {
			var r = eval(document.getElementById('raprdmimage'));
			r.style.visibility = 'hidden';
			r.innerHTML = '';
		
			newImg = document.createElement('img');
			newImg.setAttribute('src',s);
			r.appendChild(newImg);
			switchVisibility('obj3d',0);
			setTimeout("switchVisibility('raprdmimage',1)",100);
			setTimeout("iFix()",100);
		} else if(t) {
			switchVisibility('obj3d',1);
			switchVisibility('raprdmimage',0);
		}
	}
}

function iFix() {
	var is_ie6 = (
	window.external &&
	typeof window.XMLHttpRequest == "undefined"
	);
	if(is_ie6) correctPNG();
}

function getFlashMovie(movieName) {   
	var isIE = navigator.appName.indexOf("Microsoft") != -1;   
	return (isIE) ? window[movieName] : document[movieName];  
} 

function send_param() {
	getFlashMovie("inpage").modelParam(tar);
}

function showFeatDesc(t,i) {
	var loc = 175;
	var loc2 = 0;
	if(i && i < 4) loc = 40;
	if(i && i > 7) loc = 310;
	if(i) {
		loc2 = 46 * i;
		loc2 = loc2 - loc;
	}
	td = document.getElementById(t);
	if(td) {
		switchVisibility(t,1);	
		td.style.left = loc2 + 'px';
	}
}

function vovLogin() {
   if (!xmlhttp) xmlhttp = aaGetXmlHttpRequest();
   if (!xmlhttp) return;
	var url = '/hivov/mcsmambo.p?M5NextUrl=RMUSR&objectType=HTML';
   xmlhttp.open('GET', url, true);
   xmlhttp.onreadystatechange = getVov;
   xmlhttp.send(null);
}

function getVov() {
	if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
		var resultStr = xmlhttp.responseText;
		var dimContent = document.getElementById('dimContent');
		if(dimContent) {
			var dimOverlay = document.createElement('div');
			dimOverlay.setAttribute('id','dimOverlay');
			var dimVov = document.createElement('div');
			dimVov.setAttribute('id', 'dimVov');
			dimContent.innerHTML = '';
	
			dimContent.appendChild(dimOverlay);
			dimContent.appendChild(dimVov);
	
			$('#dimVov').append(resultStr);
			setVisible('dimContent');
		}
	}
}

function closeVov() {
	var dimContent = document.getElementById('dimContent');
	if(dimContent) {
		dimContent.innerHTML = '';
		dimContent.style.display = 'none';
		dimContent.style.visibility = 'hidden';
	}
}

function dimContent(selfUrl,webObj,arg,exc) {   
    if (!xmlhttp) xmlhttp = aaGetXmlHttpRequest();
    if (!xmlhttp) return;
	var url = '';
	var fx = 1;
	if(webObj && arg) {
		if(webObj == 'RAPRD') {
		    url = selfUrl + '?M5NextUrl=MKHPRINF&objectType=HTML&art_id=' + arg;
		    if(exc) url += '&' + exc;   
		}
		if(webObj == 'RAHLP') url = selfUrl + '?M5NextUrl=RAHLP&objectType=HTML&' + arg;
		if(webObj == 'EXPERT') url = selfUrl + '?M5NextUrl=MKHPRINF&objectType=HTML&art_id=' + arg + '&M5Arg=EXPERT';
		if(webObj == 'KIESKEURIG') url = selfUrl + '?M5NextUrl=MKHPRINF&objectType=HTML&M5Arg=KIESKEURIG&kkUrl=' + arg;
		if(webObj == 'ABOSEL' && exc) {
	 		url = selfUrl + '?M5NextUrl=RAPRD&objectType=HTML&art_id=' + arg + '&M5Arg=ABOSEL&xart_id=' + exc;
			fx = 2;
			$('#dimmer').html('<div id="dimOverlay"></div>');	
			$('#dimmer').append('<div class="topic dimAbo dimLoad" id="aboTbls" onClick="event.cancelBubble = true;"><a id="dimCloser" onClick="hideDimmer();"><img src="{&IMGROOT}hiv2/inlinepopup/close.gif" alt="Sluit" /></a></div>');
		 	$('#dimmer').show();
		}
	} else if(webObj) url = selfUrl + '?M5NextUrl=' + webObj + '&objectType=HTML';
	if(url && fx == 1) {
	    if(webObj == 'RAHLP') {
            $.ajax({
                url: selfUrl + '?M5NextUrl=RAHLP&objectType=HTML&' + arg,
                cache: false,
                contentType: "application/x-www-form-urlencoded;charset=ISO-8859-1",
                success: function(html){
                    var resultStr = html;
            		$('#dimmer').html('<div id="dimOverlay"></div>');	
            		$('#dimmer').append(resultStr);
            		setTimeout(function() { 
            			$('#dimmer').fadeIn(400); 
            			sIFR.replace(rockwell, {
            		    selector: 'h3.title,h1.aboHeader'
            			 ,wmode: 'transparent'
            		    ,css: [
            		      '.sIFR-root { text-align: left; color: #352171; }'
            		      ,'a { text-decoration: none; }'
            		      ,'a:link { color: #352171; }'
            		      ,'a:hover { color: #352171; }'
            		    ]
            		   });
            			setLights();
            		}, 100);
                }
            });
	    } else {
    	   xmlhttp.open('GET', url, true);
    	   xmlhttp.onreadystatechange = getContent;
    	   xmlhttp.send(null);
    	}
	} else if(url) {
		setTimeout(function() {
            xmlhttp.open('GET', url, true);
            xmlhttp.onreadystatechange = getContent;
            xmlhttp.send(null);
		},400);
	}
}

function getContent() {
	if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
		var resultStr = xmlhttp.responseText;
		$('#dimmer').html('<div id="dimOverlay"></div>');	
		$('#dimmer').append(resultStr);
		setTimeout(function() { 
			$('#dimmer').fadeIn(400); 
			sIFR.replace(rockwell, {
		    selector: 'h3.title,h1.aboHeader'
			 ,wmode: 'transparent'
		    ,css: [
		      '.sIFR-root { text-align: left; color: #352171; }'
		      ,'a { text-decoration: none; }'
		      ,'a:link { color: #352171; }'
		      ,'a:hover { color: #352171; }'
		    ]
		   });
			setLights();
		}, 100);
	}
}

function hideDimmer() {
	$('#dimmer').fadeOut(400);
	setTimeout(function() {
		$('#dimmer').html('');
	},400);
}

function setLightbox(url) {
    if (!xmlhttp) xmlhttp = aaGetXmlHttpRequest();
    if (!xmlhttp) return;
	if(url) {
	   xmlhttp.open('GET', url, true);
	   xmlhttp.onreadystatechange = getLightBox;
	   xmlhttp.send(null);
	} 
}

function getLightBox() {
	if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
		var resultStr = xmlhttp.responseText;
		$('#dimmer').html('<div id="dimOverlay"></div>');	
		$('#dimmer').append('<div id="dimContent2" class="dimContent2" onClick="event.cancelBubble = true;">'+resultStr+'</div>');
		setTimeout(function() { 
			$('#dimmer').fadeIn(400); 
		}, 100);
	}
}

function doSrch(selfUrl,tar,val) {
    if (!xmlhttp) xmlhttp = aaGetXmlHttpRequest();
    if (!xmlhttp) return;
    if(tar && val) $('#'+tar).val(val);
    
    if(tar && tar == 'ALL') {
        $('#srch_query').val('');  
        $('#M5ResultPage').val('1');
        $('#af_id').val('');
        $('#abo_id').val(''); 
        $('#abo_options').val('');   
        $('.rsrchUL li label').removeClass('selected'); 
        $('.rsrchUL li label').addClass('unselected'); 
        $('#selAboOptions').fadeOut();
    }
    
    var artLimit = $('#M5ArtLimit').val();
    var ab_agid = $('#ab_agid').val();
    var resultPage = $('#M5ResultPage').val();
    var srch_query = $('#srch_query').val();
    var af_id = $('#af_id').val();  
    var id1 =  $('#id1').val(); 
    var id2 =  $('#id2').val(); 
    var id3 =  $('#id3').val(); 
    var score = $('#score').val(); 
    var abo_id = $('#abo_id').val(); 
    var abo_options = $('#abo_options').val(); 
    if(srch_query == '') var setSuppQQuery = 'ALL'; else var setSuppQQuery = '';
    var url = selfUrl+'?M5NextUrl=RSRCH&M5CurrUrl=RSRCH&objectType=HTML&ab_agid=' + ab_agid + '&M5ArtLimit='+artLimit+'&M5ResultPage='+resultPage+'&setSuppQQuery='+setSuppQQuery+'&srch_query='+srch_query+'&af_id='+af_id;
    url += '&abo_id='+abo_id+'&abo_options='+abo_options+'&score='+score+'&id1='+id1+'&id2='+id2+'&id3='+id3+'&srch_attr=supp_id&srch_expr=CONTAINS&postTime=' + new Date().getTime();

    $('#srchRes').fadeOut(400);
    $('#srchRight').addClass('srLoading');
    xmlhttp.open('GET', url, true);
    xmlhttp.onreadystatechange = function() { getSrch(selfUrl); }
    xmlhttp.send(null);
}

function getSrch(selfUrl) {
	if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
		var resultStr = xmlhttp.responseText;  
	    if(resultStr) {
	        setTimeout(function() {
	            $('#srchRes').html(resultStr);
	            $('#srchRight').removeClass('srLoading');
	            $('#srchRes').fadeIn();
	            srchCare(selfUrl);
	        },400);    
	    }
	}  
}

function srchEval(selfUrl,tar,string,thisid) {
    $('#M5ResultPage').val('1');
    var isChecked = false;
    if($('#'+thisid).hasClass('unselected')) {
        isChecked = true;
        $('#'+thisid).removeClass('unselected');    
        $('#'+thisid).addClass('selected');  
    } else {
        isChecked = false;
        $('#'+thisid).removeClass('selected');
        $('#'+thisid).addClass('unselected');    
    }
    var tarVal = $('#'+tar).val();
    var newStr = '';
    var results = tarVal.split(',');
    if(isChecked) {
        if(tarVal == '') tarVal = string; else tarVal += ',' + string;   
        $('#'+tar).val(tarVal);          
    } else {
        for(var i=0;i<results.length;i++) {
            if(results[i] != string) {
                if(newStr == '') newStr = results[i]; else newStr += ',' + results[i];    
            }    
        }
        $('#'+tar).val(newStr); 
    }
    doSrch(selfUrl);
}

function srchAboEval(selfUrl,tar,string,thisid) {
    var tarVal = $('#'+tar).val();
    if(tar == 'abo_id') $('.aboSelUl').removeClass('selected'); else $('.optSelUi').removeClass('selected');
    if(tarVal == string) {
        $('#'+tar).val('');   
        $('#'+thisid).removeClass('selected');
        $('#'+thisid).addClass('unselected'); 
        if(tar == 'abo_id') { $('#selAboOptions').fadeOut(); $('#abo_options').val(''); }  
    } else {
        $('#'+tar).val(string);       
        $('#'+thisid).removeClass('unselected');    
        $('#'+thisid).addClass('selected'); 
        if(tar == 'abo_id') $('#selAboOptions').fadeIn(); 
    }
    doSrch(selfUrl);
}

function srchCare(selfUrl) {
    var iArt = parseFloat($('#prCount').val());      
    var iLimit = parseFloat($('#M5Limit').val());  
    var iResultPage = parseFloat($('#M5ResultPage').val()); 
    var stBefore = '';
    var iPage = Math.round((iArt / iLimit) + 0.49);
    if(iArt > 0) $('.srchPages').html('<span>Pagina: </span>'); else $('.srchPages').html('<span></span>');
    for(var i=1;i<=iPage;i++) {
        if(i == 1) stBefore = ''; else stBefore = ' - ';
        if(i == iResultPage) {
            $('.srchPages').append(stBefore+'<a class="pagenum pnActive" onClick="doSrch(\''+selfUrl+'\',\'M5ResultPage\','+i+');">'+i+'</a>');      
        } else {
            $('.srchPages').append(stBefore+'<a class="pagenum" onClick="doSrch(\''+selfUrl+'\',\'M5ResultPage\','+i+');">'+i+'</a>');     
        }
    }
    $('.srchPages').append('<span> (<strong>'+iArt+'</strong> telefoons in je selectie)</span>');
    if(iArt == 0) $('#noResults').show(); else $('#noResults').hide(); 
}

function soPop(selfUrl) {
    $(document).ready(function() {
        var art_id = '';        
        $('.soBox table .soArt').bind('click', function() { location = $('.soHref', this).attr('href'); });
        $('.soBox table tr').hover(function() {
            $('td', this).css('background','#cccccc');   
            $('td', this).css('cursor','pointer');   
            $('.td6', this).css('background','#e6d30e'); 
        }, function() {
            $('td', this).css('background','#ededed'); 
            $('td', this).css('cursor','normal');      
            $('.td1', this).css('background','#e4e4e4'); 
            $('.td6', this).css('background','#fbe60a'); 
        });
        
        $('.soBox table th .soInfo').hover(function(e) { 
            var x = e.pageX + 20;
            var y = e.pageY - 15;
            if($(this).hasClass('soiLast')) x = e.pageX - 280;
            $('body').append('<div id="soInfo" style="left: ' + x + 'px; top: ' + y + 'px">' + $('.af_wdesc', this).html() + '</div>');   
        }, function() {
            $('#soInfo').remove();
        });  
        
        $('.soBox table .td1 .artInfo').hover(function(e) { 
            var x = e.pageX + 20;
            var y = e.pageY - 15;
            if($(this).hasClass('artLate')) y = e.pageY - 115;
            art_id = $('.abArt', this).html();
            $('body').append('<div id="soSpecs" style="left: ' + x + 'px; top: ' + y + 'px"><div class="sosDetails sosLoading"></div></div>');   
            soInfo(selfUrl, art_id);
        }, function() {
            $('#soSpecs').remove();
        });  
    }); 
}

function soAdd(selfUrl, art_id, isChecked, ca_id, ab_agid, t) {
    var xart_id = $('#so_xartid').val();
    var newList = '';
    xart_id = xart_id.split(',');
    for(var i=0;i<xart_id.length;i++) {
        if(xart_id[i] != art_id) {
            if(newList) newList += ',' + xart_id[i]; else newList = xart_id[i];     
        }    
    } 
    if(isChecked) { if(newList) newList += ',' + art_id; else newList = art_id; }
    $('#so_xartid').val(newList);    
    
    $.ajax({
        url: selfUrl + '?M5NextUrl=RAPRL&ab_agid='+ab_agid+'&objectType=HTML&M5Arg='+ca_id+'&xart_id='+newList,
        cache: true,
        contentType: "application/x-www-form-urlencoded;charset=ISO-8859-1",
        success: function(html){
            var resultStr = html;
            $('#soBox'+t+' .soContent').html(resultStr);
            setTimeout(function() { 
                soPop(selfUrl); 
                if(isChecked) {
                    $('#ds_'+art_id+'_'+t).css('display','block'); 
                    $('#'+art_id+'_'+t+'_star').show();
                } else {
                    $('#ds_'+art_id+'_'+t).css('display','none');
                    $('#'+art_id+'_'+t+'_star').hide();
                }
            },50);
        }
    });
    
    
} 

function soInfo(selfUrl, art_id) {
    $.ajax({
        url: selfUrl + '?M5NextUrl=RAPRD&art_id='+art_id+'&objectType=HTML&M5Arg=SIMONLY',
        cache: true,
        contentType: "application/x-www-form-urlencoded;charset=ISO-8859-1",
        success: function(html){
            var resultStr = html;
    		$('#soSpecs').html('<div class="sosDetails">' + resultStr + '</div>');
        }
    });
}

function optChange(selfUrl,ar_id,v) {
    var xart_id = $('#'+ar_id+'_change').val();
    if(v) xart_id += ',' + v;
    var url = selfUrl + '&xart_id='+xart_id;
    location = url;
}  

function alignBoxes() {
    $(document).ready(function() {
        $('.rightScope .prBox').each(function() {
            $('.leftScope').prepend('<div class="prBox right">' + $(this).html() + '</div>');   
            $(this).remove();
        }); 
    });   
}

function clearCache() {
    $(document).ready(function() {
        $('#id1').val('');
        $('#id2').val('');
        $('#id3').val('');   
    });
    
}

function switchOption(thisId,isChecked) {
    if(thisId) {
        var idSplit = thisId.split('_');
        var elm = document.getElementsByTagName('input');
        for(var i=0;i<elm.length;i++) {
            if(elm[i].id) {
                var thiselm = elm[i].id.split('_');
                if(thiselm[1]) {
                    if(idSplit[0] == thiselm[0] && idSplit[1] == thiselm[1]) {
                        if(elm[i].id == thisId && isChecked) 
                            document.getElementById(elm[i].id).checked = true;   
                        else 
                            document.getElementById(elm[i].id).checked = false;    
                    }   
                } 
            }    
        }
    }
}

// FUNCTIE VOOR HET OPENEN VAN EEN LIGHTBOX BIJ RETENTIE SHOPS NA INLOGGEN
function dimFlash(selfUrl, arg) {
    $(document).ready(function() {
        if(selfUrl && arg) {
            $.ajax({
                url: selfUrl + '?M5NextUrl=RAHLP&objectType=HTML&M5Arg=PROMO&helpSubject=' + arg,
                cache: false,
                success: function(html){
                    var resultStr = html;
            		$('#dimmer').html('<div id="dimOverlay"></div>');	
            		$('#dimmer').append(resultStr);
            		setTimeout(function() { 
            			$('#dimmer').fadeIn(400); 
            			sIFR.replace(rockwell, {
            		    selector: 'h3.title,h1.aboHeader'
                        ,wmode: 'transparent'
            		    ,css: [
            		      '.sIFR-root { text-align: left; color: #352171; }'
            		      ,'a { text-decoration: none; }'
            		      ,'a:link { color: #352171; }'
            		      ,'a:hover { color: #352171; }'
            		    ]
            		   });
            		}, 100);
                }
            });    
        }
    });
}

// TELLER
function teller(selfUrl, art_id) {
    if(selfUrl && art_id) {
        var stUrl = selfUrl + '?M5NextUrl=MKHPRINF&objectType=HTML&M5Arg=TELLER&art_id=' + art_id;
        $.ajax({
            url: stUrl,
            cache: false,
            success: function(html){
                $('#teller').html(html);
            }
        });    
    }
}