// ready for jQuery DOM manipulation
$(document).ready(function(){
	$('#tdx_tabs .tdx_tab a').click(function(){
		// get the div id #
		var div = $(this).parent().get(0);
		
		if (div.id !== "tdx_tab_tb") {
		
			var tmp = div.id.split('_');
			var id_active =  tmp[2];
		
			// deactivate all tabs and panes
			$('#tdx_tabs .tdx_tab').removeClass("active");
			$('.content_pane').hide();
			// activate clicked tab
			$('#tdx_tab_'+id_active).addClass("active");
			$('#showText'+id_active).show();
			
			if (id_active == "1"){
				$("#imgTab1").show();
				$("#infoTab1").show();
				$("#showLbl1").show();
				$("#showRechts1").show();
				$("#showLbl5").hide();
				$("#showRechts5").hide();
				$("#rechterkolom").show();
				$("#pane_1_buttons").show();
			} else if (id_active == "5"){
				$("#imgTab1").hide();
				$("#infoTab1").show();
				$("#showLbl1").hide();
				$("#showRechts1").hide();
				$("#showLbl5").show();
				$("#showRechts5").show();
				$("#rechterkolom").show();
				$("#pane_1_buttons").hide();
			} else	{
				$("#imgTab1").hide();
				$("#infoTab1").hide();
				//$("#rechterkolom").style.width = "5px";
				$("#rechterkolom").hide();
				$("#pane_1_buttons").hide();
			}
			
			// add maps iframe
			$("#campingmap").remove();
			if ($(div).hasClass("tab_map")) {
				var iframe_url = $("#iframe_url").val();
				var map_width = $("#map_width").val();
				var map_height = $("#map_height").val();
				$(".map_pane").append('<iframe id="campingmap" height="'+map_height+'" frameborder="0" width="'+map_width+'" src="'+iframe_url+'" marginwidth="0" marginheight="0" name="Camping Maps"><p>Your needs to support Iframes for this feature.</p></iframe>');
			}
		}
		
		return false;
		
	});
	
	// for extra button
	$('#tdx_button_unt a').click(function(){
		$('#tdx_tab_5 a').click();
		return false;
	});

});

/*
function tab(fld)
{
	for (t=1; t<=5; t++)
	{
		if (t == fld)
		{
			sT = "showTab" + t;
			sC = "showText" + t;
			elT = document.getElementById(sT);
			elC = document.getElementById(sC);
			elT.style.display = "inline"; 
			elC.style.display = "inline"; 
		}
		else
		{
			sT = "showTab" + t;
			sC = "showText" + t;
			elT = document.getElementById(sT);
			elC = document.getElementById(sC);
			elT.style.display = "none"; 
			elC.style.display = "none"; 
		}

		if (fld == "1")
		{
			document.getElementById("imgTab1").style.display = "inline";
			document.getElementById("infoTab1").style.display = "inline";
			document.getElementById("showLbl1").style.display = "inline";
			document.getElementById("showRechts1").style.display = "inline";
			document.getElementById("showLbl5").style.display = "none";
			document.getElementById("showRechts5").style.display = "none";
		}
		else if (fld == "5")
		{
			document.getElementById("imgTab1").style.display = "none";
			document.getElementById("infoTab1").style.display = "inline";
			document.getElementById("showLbl1").style.display = "none";
			document.getElementById("showRechts1").style.display = "none";
			document.getElementById("showLbl5").style.display = "inline";
			document.getElementById("showRechts5").style.display = "inline";
		}
		else
		{
			document.getElementById("imgTab1").style.display = "none";
			document.getElementById("infoTab1").style.display = "none";
			document.getElementById("rechterkolom").style.width = "5px";
		}
	}
}
*/
function accoshow(accoid, nrofaccos)
{
	var acco_array = nrofaccos.split("|");
	for (var loop=0; loop < acco_array.length; loop++)
	{
		sA = "acco" + acco_array[loop];
		elA = document.getElementById(sA);
		elA.style.display = "none";
		sA = "accoinventaris" + acco_array[loop];
		elA = document.getElementById(sA);
		elA.style.display = "none";
		sA = "accoimage" + acco_array[loop];
		elA = document.getElementById(sA);
		elA.style.display = "none";
		sA = "accokort" + acco_array[loop];
		elA = document.getElementById(sA);
		elA.style.display = "none";
	}
	sA = "acco" + accoid;
	elA = document.getElementById(sA);
	elA.style.display = "inline";
	sA = "accoinventaris" + accoid;
	elA = document.getElementById(sA);
	elA.style.display = "inline";
	sA = "accoimage" + accoid;
	elA = document.getElementById(sA);
	elA.style.display = "inline";
	sA = "accokort" + accoid;
	elA = document.getElementById(sA);
	elA.style.display = "inline";
}
function submitCode(link, wrid, cid, reiscode, datum, duur, prijs, acc, lngid, web, dag, maand)
{
  var x = new Date();
  var time = x.getTime();
  CurrentLink='3261.asp?wrid=' + wrid + '&cid=' + cid + '&reiscode=' + reiscode + '&datum=' + datum + '&duur=' + duur + '&prijs=' + prijs + '&acc=' + acc + '&lngid=' + lngid;
  if (web == 0) {
    if (link != '') {
    	link = link.replace('<reiscode>', reiscode);
    	link = link.replace('<duur>', (duur - 1));
    	link = link.replace('<vertrekdag>', dag);
    	link = link.replace('<vertrekmaand>', maand);
    	top.location.href=link;
    } else if (lngid == 3) {
    	top.location.href='http://www.go4camp.de/suchen?bolignr=' + reiscode.replace('/', '*').replace(' ', '') + '&valength=' + (duur - 1) + '_n&arday=' + dag + '&armonth=' + maand + '&adults=&under12=&u12value=';
    } else {
    	top.location.href='http://www.go4camp.nl/boeking?bolignr=' + reiscode.replace('/', '*').replace(' ', '') + '&valength=' + (duur - 1) + '_n&arday=' + dag + '&armonth=' + maand + '&adults=&under12=&u12value=';
    }
  } else {
    popup=window.open(CurrentLink, 'popupnav', 'width=500,height=685,scrollbars=yes'); 
    popup.focus(); 
  }
}