var UserOK

$(document).ready(function() {
	$('.footerlinks .button').hover(
		function(){ $(this).parent().find('.tooltip').show() },
		function(){ $(this).parent().find('.tooltip').hide() }
	)
	$('.footerlinks .button2').hover(
	function(){ $(this).parent().find('.tooltip2').show() },
	function(){ $(this).parent().find('.tooltip2').hide() }
	)
})

function loadCSS(scriptName) {
	var scriptElem = document.createElement('link'); 
	scriptElem.setAttribute('rel','stylesheet'); 
	scriptElem.setAttribute('type','text/css'); 
	scriptElem.setAttribute('src',_PROJECT_URL+scriptName); 
	document.getElementsByTagName('head')[0].appendChild(scriptElem); 
}

//All fields with id filled in are required fields.
function cOn(td, color) {
    if(document.getElementById||(document.all && !(document.getElementById))) {
	  td.style.backgroundColor= color;
	  td.style.cursor = 'pointer';
	}
}
function cOut(td,color) {
    if(document.getElementById||(document.all && !(document.getElementById))) {
	  td.style.backgroundColor= color;
	}
}

function openOverlay(title,url,width,height) {
	GB_showCenter(title, url, /* optional */ height, width)
}

function initSIFR() {
	if(typeof sIFR == "function"){
		sIFR.replaceElement(named( {
			sSelector:"h1.grey",
			sFlashSrc:_PROJECT_URL + "flash/h1.swf",
			sColor:"#333333",
			sLinkColor:"#333333", 
			sHoverColor:"#FF6600", 
			sWmode:"transparent",
			nPaddingTop:0,
			nPaddingBottom:0,
			sFlashVars:"textalign=left&offsetTop=0"
			}
		));
		sIFR.replaceElement(named( {
			sSelector:"h1.orange",
			sFlashSrc:_PROJECT_URL + "flash/h1.swf",
			sColor:"#f24f00",
			sLinkColor:"#333333", 
			sHoverColor:"#FF6600", 
			sWmode:"transparent",
			nPaddingTop:0,
			nPaddingBottom:0,
			sFlashVars:"textalign=left&offsetTop=0"
			}
		));
		
		sIFR.replaceElement(named( {
			sSelector:"h1",
			sFlashSrc:_PROJECT_URL + "flash/h1.swf",
			sColor:"#ffffff",
			sLinkColor:"#ffffff", 
			sHoverColor:"#FF6600", 
			sWmode:"transparent",
			nPaddingTop:0,
			nPaddingBottom:0,
			sFlashVars:"textalign=left&offsetTop=0"
			}
		));
		sIFR.replaceElement(named( {
			sSelector:"h2.grey",
			sFlashSrc:_PROJECT_URL + "flash/h1.swf",
			sColor:"#333333",
			sLinkColor:"#333333", 
			sHoverColor:"#FF6600", 
			sWmode:"transparent",
			nPaddingTop:0,
			nPaddingBottom:0,
			sFlashVars:"textalign=left&offsetTop=0"
			}
		));
		sIFR.replaceElement(named( {
			sSelector:"h2.orange",
			sFlashSrc:_PROJECT_URL + "flash/h1.swf",
			sColor:"#f24f00",
			sLinkColor:"#333333", 
			sHoverColor:"#FF6600", 
			sWmode:"transparent",
			nPaddingTop:0,
			nPaddingBottom:0,
			sFlashVars:"textalign=left&offsetTop=0"
			}
		));
		
		sIFR.replaceElement(named( {
			sSelector:"h2",
			sFlashSrc:_PROJECT_URL + "flash/h1.swf",
			sColor:"#ffffff",
			sLinkColor:"#ffffff", 
			sHoverColor:"#FF6600", 
			sWmode:"transparent",
			nPaddingTop:0,
			nPaddingBottom:0,
			sFlashVars:"textalign=left&offsetTop=0"
			}
		));
		sIFR.replaceElement(named( {
			sSelector:"h3",
			sFlashSrc:_PROJECT_URL + "flash/h1.swf",
			sColor:"#333333",
			sLinkColor:"#333333", 
			sHoverColor:"#000000", 
			sWmode:"transparent",
			nPaddingTop:0,
			nPaddingBottom:0,
			sFlashVars:"textalign=left&offsetTop=0"
			}
		));
		sIFR.replaceElement(named( {
			sSelector:"h4",
			sFlashSrc:_PROJECT_URL + "flash/h1.swf",
			sColor:"#ffffff",
			sLinkColor:"#ffffff", 
			sHoverColor:"#FF6600", 
			sWmode:"transparent",
			nPaddingTop:0,
			nPaddingBottom:0,
			sFlashVars:"textalign=left&offsetTop=0"
			}
		));		
	};
}

function MouseOver(obj){
	obj = document.getElementById(obj)
	if (obj){
		if (obj.src.indexOf('_on') > -1){
			obj.src = obj.src.replace('_on.png','.png')
		}else{
			obj.src = obj.src.replace('.png','_on.png')
		}
	}
}

function MouseOverArt(obj){
	obj = document.getElementById(obj)
	if (obj){
		if (obj.className.indexOf('_on') > -1){
			obj.className = obj.className.replace('_img_on','_img')
		}else{
			obj.className = obj.className.replace('_img','_img_on')
		}
	}
}

function getCheckboxValue(id) {
	var allInputTags = document.getElementById(id+'_group').getElementsByTagName('INPUT');
	for (var c=0; c<allInputTags.length; c++) {
		if (allInputTags[c].checked) {
			return allInputTags[c].value;
			break;
		}
	}
	return ""
}

function hide(id){if(document.getElementById(id)) document.getElementById(id).style.display='none'}

function del_onclick(str) {
	return confirm('Weet u zeker dat u ' + str + ' wilt verwijderen?');
}

function selAll() {
	var span = document.getElementById('checkboxes').getElementsByTagName('INPUT')
	var select = span[0].checked
	for(i=0;i<span.length;i++){
		if(span[i].type=='checkbox'){
			span[i].checked = select
		}
	}
}

function countChars(id,qty) {
	var obj = document.getElementById(id)
	obj.onclick=function(){document.getElementById('cntChars').innerHTML = qty - obj.value.length}
	obj.onkeyup=function(){
		document.getElementById('cntChars').innerHTML = qty - obj.value.length; 
		if (obj.value.length >= qty){
			document.getElementById(id).value=document.getElementById(id).value.substring(0,qty)
		}
	}
	document.getElementById('cntChars').innerHTML = qty - obj.value.length
}

function printme() {
	var objOut = document.getElementById("output");
	var out = objOut.innerHTML;
		
	var wh = window.open("","wh","width=640px,height=480px,scrollbars=yes");
	wh.document.open();
	var output = '<link href="css/print.css" rel="stylesheet" type="text/css">';
	output = '<html><head>'+output+'</head><body>'+out.replace('<object','<!--object').replace('/object>','/object-->')+'</body></html>';
	output += '<'+'script type="text/javascript">';
	output += 'setTimeout("window.print()",2000);';	
	output += '</'+'script>';
	wh.document.writeln(output);
	wh.document.close();
}

function changeImage(id,url){    
	if(document.getElementById(id)){
		document.getElementById(id).src = url;
	}
}


//Toevoegen van een youtube movie
function loadYouTube(url){
if (url.indexOf("http://") == 0) 
	{
		var so = new SWFObject(""+url+"", "site", "200", "150", "8,0,0,0", "#000000");
	} else {
		var so = new SWFObject("http://www.youtube.com/v/"+url+"&rel=1", "site", "200", "150", "8,0,0,0", "#000000");
	}	
	so.addParam("allowFullscreen","true")
	so.write("video_box");
}

function setClass(obj,className){    
    obj.className = className
}

function display(id,arr) {
	if(arr!=undefined) {
		var a = arr.split(',')
		for(i=0;i<a.length;i++){
			if(document.getElementById(a[i])) document.getElementById(a[i]).style.display='none'
		}
	}
	if(id!=''){
		if(document.getElementById(id)){
			var obj = document.getElementById(id).style
			if(obj.display=='none'){
				obj.display='block'
			}
		}
	}
	return false
}

function hideObj(div) {
	var obj = document.getElementById(div);
	obj.style.display = 'none';
}
function showObj(div) {
	var obj = document.getElementById(div);
	obj.style.display = 'block';
}

function changevaluta(url,id){
	location.href=url + '?currency=' + id
}

function updateSelectedArticles(id){
	var obj = document.getElementById('cont_extraArticles')
	var selected = false
	if(document.getElementById('extraArticles_'+id).checked) selected = true
	if(selected){  //check on
		if(obj.value.indexOf(','+id+',')==-1){
			if(obj.value=='') obj.value += ','
			obj.value += id + ','
		}
	}else{ //check off
		obj.value = obj.value.replace(','+ id +',',',')
		if(obj.value==',') obj.value = ''
	}
}

function showHideDeliveryAddress(){
	if(document.getElementById('deliveryData').style.display=='none'){
			hide('deliveryDummy')
			showObj('deliveryData')
	}else{
			showObj('deliveryDummy');hide('deliveryData')
	}
	GetAJAX('getRatesAndShippingService.xml.asp','deliveryMethods',Array('zipcode','invoicecountryid','deliverycountryid','delivery'),Array(document.getElementById('deliveryzipcode').value,document.getElementById('invoicecountry').options[document.getElementById('invoicecountry').selectedIndex].value, document.getElementById('deliverycountry').options[document.getElementById('deliverycountry').selectedIndex].value,document.getElementById('otherDeliveryAddress').checked))
}

function searchISAPI(v,tr_search){
	document.location.href = _PROJECT_URL + tr_search + '/'+ escape(v)
}
