function Enlarge(ID, width, height, alt){
	var scroll = "no";
	var top=0, left=0;
	if(width > screen.width-10 || height > screen.height-28) scroll = "yes";
	if(height < screen.height-28) top = Math.floor((screen.height - height)/2-14);
	if(width < screen.width-10) left = Math.floor((screen.width - width)/2-5);
	width = Math.min(width, screen.width-10);
	height = Math.min(height, screen.height-28);
	var wnd = window.open("","","scrollbars="+scroll+",resizable=yes,width="+width+",height="+height+",left="+left+",top="+top);
	wnd.document.write("<html><head>\n");
	wnd.document.write("<"+"script language='JavaScript'>\n");
	wnd.document.write("<!--\n");
	wnd.document.write("function KeyPress()\n");
	wnd.document.write("{\n");
	wnd.document.write("	if(window.event.keyCode == 27)\n");
	wnd.document.write("		window.close();\n");
	wnd.document.write("}\n");
	wnd.document.write("//-->\n");
	wnd.document.write("</"+"script>\n");
	wnd.document.write("<title>"+(alt == ""? "Image":alt)+"</title></head>\n");
	wnd.document.write("<body topmargin=\"0\" leftmargin=\"0\" marginwidth=\"0\" marginheight=\"0\" onKeyPress=\"KeyPress()\">\n");
	wnd.document.write("<img src=\""+ID+"\" border=\"0\" alt=\""+alt+"\">");
	wnd.document.write("</body>");
	wnd.document.write("</html>");
	wnd.document.close();
}
	
function Purchase(){
	var el = document.forms['purchase'].elements['license_id'];
    
	var is_checked;
    if(!el.length) {
		if(el.checked){
			is_checked = 1;
		}
    }
    else {
	    for(var i=0; i<el.length; i++){
		    if(el[i].checked){
			    is_checked = 1;
			    i = el.length;
		    }
	    }
    }
        
	if(is_checked == 1){
		return true;
	}
	else{
		alert('Please select the license type!');
		return false;
	}
}


function PurchaseTotal(){
	var f = document.forms['purchase'];
	var price = 0;
	for(var i=0; i<f.elements.length; i++){
		if(f.elements[i].type == "checkbox" && f.elements[i].checked && !f.elements[i].disabled){
            price += parseFloat(f.elements[f.elements['license[' + f.elements[i].value + ']'].value].value);
		}
	}
	document.getElementById('total').innerHTML = price;
}

function SubmitPurchase(lang){
	if(document.getElementById('total').innerHTML == "0" || document.getElementById('total').innerHTML == "<b>0</b>"){
        /*
        if(lang == 'DE')
            alert('Bitte w&auml;hlen Sie mindestens ein Produkt und die ben&ouml;tigte Lizenz.');
        else
		    alert('Please check at least one product and choose the type of license!');
        */
        alert('Please check at least one product and choose the type of license!');
		return false;
	}
	else{
		return true;
	}
}


function correctPNG() {
   if (navigator.appName=="Microsoft Internet Explorer") {
	  var img = document.images['logo'];
      img.outerHTML = '<span id="logo" alt="Microsoft Excel Add-ins" style="display:inline-block; width:328; height:69; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'/images/logo.png\', sizingMethod=\'scale\');"></span>';
   }
}