
function Popup(){}
Popup.current = null;
Popup.close = function(){
	if(Popup.current != null){
		Popup.current.close();
	}
}
Popup.open = function(href, width, height, target, paramobject){
	Popup.close(); //close of open
		
	//set propertys
	var setting =  typeof(paramobject) == 'object' ? paramobject : Popup.Presets['default'].param;
	setting.width = parseInt(width); 
	setting.height = parseInt(height);
	
	setting = Popup.objectParamToString(setting);
  
	//create new popup
	Popup.current  = window.open(href,target,setting);
	with(Popup.current){
		document.bgColor = "#FFFFFF";
		focus();
	}
}
Popup.objectParamToString = function(param){
	var ret = '';
	var add = false;
	for(var prop in param){
		ret += add ? ',' : '';
		var value = '';
		if(typeof(param[prop]) == 'number'){
			value = param[prop];
		}else if(typeof(param[prop]) == 'string'){
			value = param[prop];
		}else{
			value = param[prop] == true ? 'yes' : 'no';
		}
		
		ret += prop+'='+value;
		add = true;
	}
	return ret;
}
Popup.openByPreset = function(href, presetname){
		if(presetname == undefined) presetname = 'default';
		for(var name in Popup.Presets){
			if(name == presetname){
				var preset = Popup.Presets[name];
				Popup.open(href, preset.width, preset.height, preset.target, preset.param);
			}
		}
}
Popup.Presets = {};
Popup.addPreset = function(name, width, height, target, param){
	Popup.Presets[name] = {width: width, height: height, target: target, param: param};
}

/*
	popup presets
*/
Popup.addPreset('default', 800, 600, '_blank', {toolbar:false,statusbar:false,scrollbars:false,menubar:false});
Popup.addPreset('keyword', 1010, 800, '_blank', {resizable:false,toolbar:false,status:false,scrollbars:false,menubar:false,dependent:true});


/* 

old
popup funktions 

*/
var popup = null;
function ShowPopup(url,param){
	if(popup != null){
		popup.close();
	}
	popup  = window.open(url,"_blank",param);
	popup.moveTo(100, 100);
	popup.document.bgColor = "#FFFFFF";
	popup.focus();
}
function OpenCalculator(type){
	var url = 'http://www.be-quiet.net/be-quiet.net/index.php?StoryID=45&websiteLang='+Doc.language;
	if(type == 'expert'){
		url = 'http://www.be-quiet.net/be-quiet.net/index.php?StoryID=44&websiteLang='+Doc.language;
	}
	ShowPopup(url,'width=1030,height=750,dependent=yes,resizable=no,location=no,status=no,toolbar=no,scrollbars=yes');
}
function OpenTipSelector(){
	ShowPopup('http://www.be-quiet.net/be-quiet.net/index.php?StoryID=33&websiteLang='+Doc.language,'width=645,height=500,dependent=no,resizable=no,location=no,status=no,toolbar=no,scrollbars=no');
}

function ComparePSU(ProductID){
	ShowPopup('index.php?StoryID=23&websiteLang='+Doc.language+'&ProductID='+ProductID,'width=1014,height=680,dependent=no,resizable=no,location=no,status=no,toolbar=no,scrollbars=yes');
}
function CompareFAN(ProductID){
	ShowPopup('index.php?StoryID=35&websiteLang='+Doc.language+'&ProductID='+ProductID,'width=1014,height=680,dependent=no,resizable=no,location=no,status=no,toolbar=no,scrollbars=yes');
}
function CompareCooler(ProductID){
	ShowPopup('index.php?StoryID=61&websiteLang='+Doc.language+'&ProductID='+ProductID,'width=1014,height=680,dependent=no,resizable=no,location=no,status=no,toolbar=no,scrollbars=yes');
}
function OpenPrint(ProductID){
	ShowPopup('index.php?StoryID=29&websiteLang='+Doc.language+'&ProductID='+ProductID,'width=1064,height=768,dependent=no,resizable=no,location=no,status=no,toolbar=no,scrollbars=yes');
}
function vergleichprint(url){
	ShowPopup(url,'width=1064,height=768,dependent=no,resizable=no,location=no,status=no,toolbar=no,scrollbars=yes');
}
function show360(verzeichnis){
	ShowPopup('http://www.be-quiet.net/be-quiet.net/templates/html/360/'+verzeichnis+'/index.html','width=420,height=320,dependent=no,resizable=no,location=no,status=no,toolbar=no,scrollbars=yes');
}
function OpenCompare(){
	ShowPopup('index.php?StoryID=65','width=1014,height=680,dependent=no,resizable=no,location=no,status=no,toolbar=no,scrollbars=yes');
}


function openImagePopup(img_src, img_width, img_height) 
{ 
  img_width = parseInt(img_width) + 20; 
  img_height = parseInt(img_height) + 20; 
  ShowPopup(img_src, 'width=' + img_width + ',height=' + img_height + ',toolbar=no,statusbar=no,scrollbars=no,menubar=no,resizable=no'); 
}

