
var bShow = false;

// bestellijst leegmaken
function deleteCartRows(){

	var sURL = _root + "include/ajax_clear_cart.asp"
	var sData = "?action=deleteitem"
	
	$.ajax({
		type: "GET",
		url: sURL + sData,
		cache: false,
		async: true,
		success: function(xml){
			
			// Reload
			window.location.reload();

		}, 
		error: function(XMLHttpRequest, textStatus, errorThrown) {
			alert(XMLHttpRequest.responseText);
		}
  	});

}

// caddy slide
function slideCaddy() {
	if (bShow == true)
	{
		$("#caddy").removeClass("open").animate({width: '125px', height: '60px'}, 'fast', function() {});	
		$("#toggle").animate({left: '0'}, 'fast', function() {});		
		$("#toggleTxt").animate({backgroundColor: '#ededed'}, 'fast', function() {});
		$("#toggle").addClass("closed");
		$(".sbag").addClass("closed");
		bShow = false;
	}
	else
	{
		$("#caddy").addClass("open").animate({width: '880px', height: '100%'}, 'fast', function() {});
		$("#toggle").animate({left: '100px'}, 'fast', function() {});
		$("#toggleTxt").animate({backgroundColor: '#e1e1e1'}, 'fast', function() {});
		$("#toggle").removeClass("closed");
		$(".sbag").removeClass("closed");
		bShow = true;
	}
}


function getProductPrice(nProductID, nVerticalID, nHorizontalID, onreturn) {
	
	var sURL = _root + "include/ajax_getproductprice.asp";
	var sData = "?pid=" + nProductID + "&vid=" + nVerticalID + "&hid=" + nHorizontalID;
	
	$.ajax({
		type: "GET",
		url: sURL + sData,
		cache: false,
		async: true,
		success: function(html){
			
			onreturn(html);

		}, 
		error: function(XMLHttpRequest, textStatus, errorThrown) {
			alert("fout");
			alert(XMLHttpRequest.responseText);
		}
  	});

}

function formatPrice(sVal) {

	sVal = Math.round(sVal*100)/100;
	sVal = sVal.toString();
	
	var nPoint = sVal.indexOf(".");
	var dec = sVal.length - nPoint;
	
	if(nPoint == -1) {
		sVal = sVal + ".00";
	} else if (dec == 2) {
		sVal = sVal + "0";
	}
	
	sVal = sVal.replace(/\./, ",");
	return "&euro; " + sVal;
		
}

function getRadioButtonValue(o) {
	
	var sVal;

	for(var i=0;i<o.length;i++) {
		if(o[i].checked) {
			sVal = o[i].value;
		}
	}
	
	return sVal;
	
}


// Flashobject activeX workaround
function makeFlashObj(sID, sPath, sWidth, sHeight, sBG)
{
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="' + sID + '" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="' + sWidth + '" height="' + sHeight + '">');
	document.write('<param name="movie" value="' + sPath + '">');
	document.write('<param name="quality" value="high">');
	document.write('<param name="bgcolor" value="' + sBG + '">');
	document.write('<embed bgcolor="' + sBG + '" src="' + sPath + '" quality="high" id="' + sID + '" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + sWidth + '" height="' + sHeight + '"></embed>');
	document.write('</object>');
}

// Flashobject activeX workaround
function makeFlashObjLive(sID, sPath, sWidth, sHeight, sBG)
{
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="' + sID + '" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="' + sWidth + '" height="' + sHeight + '">');
	document.write('<param name="movie" value="' + sPath + '">');
	document.write('<param name="quality" value="high">');
	document.write('<param name="bgcolor" value="' + sBG + '">');
	document.write('<param name="wmode" value="transparent">');
	document.write('<param name="allowScriptAccess" value="always">');	
	document.write('<embed allowScriptAccess="always" wmode="transparent" bgcolor="' + sBG + '" src="' + sPath + '" quality="high" id="' + sID + '" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + sWidth + '" height="' + sHeight + '"></embed>');
	document.write('</object>');
}

function renderFlash(o){
		
	$(o).html('');
		
	var options 			= $(o).metadata({type:'attr',name:'options'});
	var sSrc 				= options.src;
	var sType 				= options.type;
	var nWidth 				= options.width;
	var nHeight 			= options.height;
	var sLink 				= options.link;
	var bAllowFullScreen 	= options.allowfullscreen;
	
	if(sType=="flash"){
	
		$(o).flash({
			swf: _root + sSrc,
			width: nWidth, 
			height: nHeight,
			expressInstall: true,
			params : {
				allowfullscreen: bAllowFullScreen
			}
		});
	
	}
	else if (sType=="flv"){
	
		$(o).flash({
			swf: _root + "swf/player.swf",
			width: nWidth, 
			height: nHeight,
			allowfullscreen: 'true',
			expressInstall: true,
			flashvars : {
				file: _wwwroot + sSrc,
				autostart: options.autostart,
				type: 'http',
				link: sLink
			},
			params : {
				allowfullscreen: bAllowFullScreen
			}
		});
		
	}
	else if (sType=="mp3"){
	
		$(o).flash({
			swf: _root + "swf/player.swf",
			width: nWidth, 
			height: nHeight,
			allowfullscreen: 'true',
			expressInstall: true,
			flashvars : {
				file: _wwwroot + sSrc,
				autostart: options.autostart,
				type: 'sound',
				link: sLink
			},
			params : {
				allowfullscreen: bAllowFullScreen
			}
		});
		
	}
	else if (sType=="youtube"){
	
		$(o).flash({
			swf: _root + "swf/player.swf",
			width: nWidth, 
			height: nHeight,
			allowfullscreen: 'true',
			expressInstall: true,
			flashvars : {
				file: options.file,
				autostart: options.autostart,
				type: 'youtube'
			},
			params : {
				allowfullscreen: bAllowFullScreen
			}
		});
	
	};
	


}



