function switchDiv() {	
	if ($("div_vt").className == 'vt') {
		$("div_vt").removeClassName("vt");
		$("div_vt").addClassName("vt_show");
		$("div_vt_gerelateerd").innerHTML = "-";
	} else {
		$("div_vt").removeClassName("vt_show");
		$("div_vt").addClassName("vt");
		$("div_vt_gerelateerd").innerHTML = "+";	
	}
}

function showWedstrijd() {
	document.getElementById('wedstrijd_trans_div').style.display='block';
	Effect.Appear('wedstrijd_main_div', { duration: 1.0 });
}
function wedstrijd() {
	document.getElementById('wedstrijd_trans_div').style.display='block';
	Effect.Appear('wedstrijd_main_div', { duration: 1.0 });
}

function check_wedstrijd(nr) {
	a = document.getElementById('wedstrijd_trans_div');
	b = document.getElementById('wedstrijd_main_div');
	
	a.style.display = 'none'
	b.style.display = 'none'
	
	if (nr == '1') {
		window.open('http://www.mondialgifts.be/pam/front/wedstrijd/wedstrijd.asp', 'Mondialgifts', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=400,height=444,left = 600,top = 400');
	}			
	new Ajax.Request("/pam/front/wedstrijd/wedstrijd_hide.asp", { method: 'POST'});
}

function writeSubCatalog(catid, artikelid) {	
	first_div = 1;
	if (document.getElementById("image_groep"+ catid)) {
		image = document.getElementById("image_groep"+ catid);
		first_div = 0;
	}
	
	if (document.getElementById("cat_groep"+ catid)) {
		div = document.getElementById("cat_groep"+ catid);
		first_div = 0;
	}
	
	if (document.getElementById("old"+ catid)) {
		old = document.getElementById("old"+ catid);
		first_div = 0;
	}
	
	if (first_div == 1) {
		div = document.getElementById("headCatalogGroup");
		
		catgroups = document.getElementById("catgroups");
		
		URLPage = "/cat/front/createSubCatalog.asp";
		URLarg = "catid="+ catid +"&level=0";
		ResponseText = AsyncHttpRequest(URLPage, URLarg, "POST", false);

		div.innerHTML = div.innerHTML + ResponseText;
	} else if (image.src == "http://"+document.domain+"/cat/back/images/icons/icon_plus.gif") {			
		image.src = "/cat/back/images/icons/icon_min.gif";
		
		level = document.getElementById("level"+ catid);
		level.value = parseInt(level.value) + 1;
		
		catgroups = document.getElementById("catgroups");
		
		URLPage = "/cat/front/createSubCatalog.asp";
		URLarg = "catid="+ catid +"&level="+ level.value;
		ResponseText = AsyncHttpRequest(URLPage, URLarg, "POST", false);
		
		old.value = div.innerHTML;
		div.innerHTML = div.innerHTML + ResponseText;
	} else {		
		div.innerHTML = old.value;
		
		level = document.getElementById("level"+ catid);
		level.value = parseInt(level.value) - 1;
		
		image = document.getElementById("image_groep"+ catid);
		
		image.src = "/cat/back/images/icons/icon_plus.gif";		
	}
	createCookieUren("lastparent", catid, 1);		
}

function checkSearch(form){
	searchfield = form.s1.value
	maxprice = form.maxprice.value
	minprice = form.minprice.value
	strOrderByField = form.s2.value
	strTable = form.s3.value
	zoekwoord = form.SValue.value
	/*
	if (zoekwoord == '' || maxprice == '' || minprice == '') { 
		alert('<%=lng_empty_search_value%>');
		return false;
	} else {
		//  document.search.action = '/cat/front/items.asp';
		//  document.search.submit();
		$('loader_div').show();
		return true;
	}*/
}

function checkSearchTop(form, errormessage){
 searchfield = form.s1.value
 strOrderByField = form.s2.value
 strTable = form.s3.value
 zoekwoord = form.SValue.value
 if (zoekwoord == ''){
  alert(errormessage);
  return false;
 }else{
//  document.search.action = '/cat/front/items.asp';
//  document.search.submit();
	return true;
 }
}

function replaceVideo() {
	$('videolink').replace('<a href="#" onclick="window.open(\'http://www.youtube.com/watch?v=9sWQhM4JXcQ\', \'\', \'fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,directories=no,location=no, width = 650, height = 600,top=30, left=30\')">IGC promotional video </a>');
}



jQuery(document).ready(function() {
	setTimeout("SwitchItem('TIP')", 5000);
});

function SwitchItem (sort) {		
	// Ajax request
	jQuery.ajax({
		url: '/ajax/GetItem.asp',  
		cache: false,
		data: ({sort : sort}),
		success: function(data) { // Success functie			
			data = data.split("\n");	
			preload_image = new Image(149,149); 
			preload_image.src = data[1];
			// Uitfaden
			jQuery("#a"+sort+" img").fadeOut('slow', function() {					
				jQuery("#a"+sort).attr("href", data[0]);
				jQuery("#a"+sort+" img").attr("src", data[1]).attr("alt", data[2]).attr("title", data[2]).fadeIn('slow', function() {	
					if ( sort == "TIP" ) {
						setTimeout("SwitchItem('NEW')", 5000);
					}
					else if ( sort == "NEW" ) {
						setTimeout("SwitchItem('TIP')", 5000);
					}
				}); // FadeIn & Restar
				
				
			}); // Uitfaden
		} // Success functie		
	}); // Ajax request
}

