﻿function openLink(url, target, width, height){
	switch(target){
		case "_self":
			window.location = url;
			break;
		case "_parent":
			window.parent.location = url;
			break;
		case "_blank":
			if(width != null && height != null){
				window.open(url, "NewWindow", "width=" + width + ",height=" + height);
			}else{
				window.open(url);
			}
			break;
		case "_under":
		    if(document.cookie.indexOf('popunder=yes') == -1){
		        var under = window.open(
		            url,
		            '',
		            'width=' +
		            screen.availWidth +
		            ',height=' +
		            screen.availHeight +
		            ',scrollbars=1,resizable=1,toolbar=1,location=1,menubar=1,status=1,directories=0'
		        );
		        under.blur();
		        window.focus();
		        document.cookie = 'popunder=yes';
		    }
		    break;
	}
}