////////////////////////////////////////////////////////////////////////////////////
///// Ecard Opener /////
////////////////////////////////////////////////////////////////////////////////////

function openFlyoutSlideshow(flag, url, themaID, catID, card) {
		//nur für das statische alpin-layout
	
		win=window.open(url,'name',"width=812,height=600,resizeable=0,toolbar=no,scrollbars=1,status=0");
/*
	var full_url, name;
	
	if (flag > 0)
	{
		name = 'unterwasserEcards'+ themaID;
		full_url = url + '&thema=' + themaID;
		
		if (card != '')
		{
			full_url = full_url + '&card=' + card;
		}
		else
		{
			full_url = full_url + '&cat=' + catID;
		}
		
		//alert('url: ' + full_url + '   name: ' + name);
	
		win=window.open(full_url,name,"width=800,height=600,resizeable=0,toolbar=no,scrollbars=0,status=0");
		
	}	*/
}


function openFlyoutImage (url, width, height) {
	var dest = "/home/news/" + document.getElementById("objectguid").firstChild.nodeValue + "?img=" + url + "&view=flyout&width="+width+"&height="+height;
	win=window.open(dest,'imageflyout',"'menubar=1 ,toolbar=0,scrollbars=0,status=0,resizable=0,height="+ height +",width=" + width + "'");
  return;
}

function openProductFlyoutImage (url, width, height) {
	var dest = "/home/news/" + document.getElementById("objectguid").firstChild.nodeValue + "?img=" + url + "&view=flyout&width="+width+"&height="+height+"&type=product";
	win=window.open(dest,'imageflyout',"'menubar=1 ,toolbar=0,scrollbars=0,status=0,resizable=0,height="+ height +",width=" + width + "'");
  return;
}


function openPrintView (url) {
	win=window.open(url,'printview');
  return;
}

function checkChoice(whichbox) {
	if (whichbox.checked == false)
		whichbox.form["heft_menge_" + whichbox.value].value = "0";
	else
		whichbox.form["heft_menge_" + whichbox.value].value = "1";
	return;
}

function checkTotal(of) {
	
	var totalAmount = of.form["total"].value;
		
	var somethingDone = false;
	
	for (var i=0;i<totalAmount;i++) {
	
		if ((of.form["heft_check_" + i].checked==true) && parseInt(of.form["heft_menge_"+i].value)>0) {
			somethingDone = true;
			break;
		}
	}
	
	if (somethingDone) {
		of.form.submit();
	}
	else
	{
		alert(unescape("Sie m%FCssen mindestens ein Heft ausw%E4hlen!"));
	}
		
	return;
}

function openEcardPopup(flag, url, themaID, catID, card) {

	var full_url, name;
	
	if (flag > 0)
	{
		name = 'alpinEcards'+ themaID;
		full_url = url + '&thema=' + themaID;
		
		if (card != '')
		{
			full_url = full_url + '&card=' + card;
		}
		else
		{
			full_url = full_url + '&cat=' + catID;
		}
		
		//alert('url: ' + full_url + '   name: ' + name);
	
		win=window.open(full_url,name,"width=800,height=600,resizeable=0,toolbar=no,scrollbars=0,status=0");
	}	
}


function submitWithChecked( f ) 
{
	
	if (document.orderform!=null) {
		var totalAmount = document.orderform["total"].value;
	
		for (var i=0;i<totalAmount;i++) {
					
			if ((document.orderform["heft_check_" + i].checked==true) && parseInt(document.orderform["heft_menge_"+i].value)>0) {
								
				var elm = document.createElement('input');
				elm.setAttribute('type','hidden');
				elm.setAttribute('name','heft_check_'+i);
				elm.setAttribute('value','true');
				f.appendChild(elm);
				
				elm = document.createElement('input');
				elm.setAttribute('type','hidden');
				elm.setAttribute('name','heft_menge_'+i);
				elm.setAttribute('value',document.orderform["heft_menge_"+i].value);
				f.appendChild(elm);		
			}
		}
	}
	
	f.submit();
}

