var newpopup=null;


/* 	###################################
	File: ./popup_open.js
	Author: eFirmy.cz
 	Descr:
	6 parameters - For default this function get called from the body onLoad from /include/popup.asp
	1) url: Default URLs are defined in the variable popuptype (see /include/popup.asp). Any url can be also sent as a string.
	2) slinkprefix, always to be passed
	3) winname - #optional - pass a different name to open a different popup from main 'newpopup'
	4) width   - #optional - default 250
	5) height  - #optional - default 250
	6) type    - #optional - default "fixed"
	Examples to call this function:
	1) Default   OpenPopup("<%'=popuptype%>","<%'=slinkprefix%>")
	2) Custom    OpenPopup("popup.asp?","<%'=slinkprefix%>",'newpop', 350,350,'location')
	
 	###################################*/
  function OpenPopup(url, slinkprefix, winname, width, height, type) {
	   if (slinkprefix.toLowerCase().indexOf('btob=') > -1) return (false);
	   if (winname==null) winname='newpopup';
	   if (width==null) width=500;
   	   if (height==null) height=470;
	   if (type==null) type="fixed";
	  switch(url) {
		    case "":
		      return (false);
		      break;
		    case "getaway":
		      url="popup.htm";
		      break;
		    case "book":
		      url="popup.htm";
		      break;
			case "search":
		      url="popup.htm";
		      break;
		    case "music":
		      url="popup.htm";
		      break;
			case "video":
		      url="popup.htm";
		      break;
			case "newcustomer":
		      url="http://shop.knihservis.cz/market/CAdetail2.php?auto=78829313&showClose=1";
		      break;
			default: url = url + slinkprefix;
		}
		var options="width="+ width +","+
      				"height="+ height;		
	  	switch(type) {
		    case "fixed":
		      options = options;
		      break;
		    case "resizable":
		      options= options +",resizable";
		      break;
		    case "toolbar":
		      options= options +",toolbar,menubar,scrollbars,resizable";
		      break;
			case "scrollbars":
		      options= options +",scrollbars";
		      break;
		    case "location":
		      options= options +",toolbar,menubar,scrollbars,resizable,location";
		      break;
			default: options = options;
		}
		newpopup = window.open(url, winname, options);
		if (newpopup!=null) {
		newpopup.focus();
		}
		return (true);
	}
	
	function openInParent(href) {
	
	if (positionMain(href)){
	
		window.open(href, "", "");
		
		}
	}
	
	function positionMain(href) {
	  if ((window.opener != null) && (!window.opener.closed)) {
	    window.opener.location = href;
		window.opener.focus();
		window.close();
	    return false;
	  } else return true;
	}	
	
	
/* 	##############################################
	GS 12/2/04 added function for Flash/SWF popups
 	##############################################  */
	
function changeOpener(href) {
    if ((window.opener != null) && (!window.opener.closed)) {
        window.opener.location = href;
        window.opener.focus();
    } else {
		window.open(href) 
    }
}
 