var w = 800, h = 600; //<--default screen-size if none detected
var defs = new Array();
defs['height'] = 400;
defs['width'] = 500;
defs['left'] = 50;
defs['top'] = 50;



function openPopUp(url, name, center, args, focus){
           // alert();
            if (document.all || document.layers) {
                w = screen.availWidth;
                h = screen.availHeight;
            }            
            
            if(args){
            	scrollbars = (args['scrollbars'])?1:0;
            	status = (args['status'])?1:0;
            	Height = (args['height'])?args['height']:defs['height'];
            	width = (args['width'])?args['width']:defs['width'];
            	topP = (args['top'])?args['top']:defs['top']; 
            	left = (args['left'])?args['left']:defs['left'];
            } else {
            	Height = defs['height'];
            	width = defs['width'];
            	scrollbars = 1;
            	status = 1;
            	topP = defs['top']; 
            	left = defs['left'];
            }
            
            if(center){    	
                left = (w- width)/2;
                topP = (h- Height)/2;
            } else {
            	
            }                     
	    myRef = window.open(url,name,'left='+left+',top='+topP+',width='+width+',height='+Height+',menubar=0, scrollbars='+scrollbars +', toolbar=0,resizable=1,  location=0, directotries=0, status='+status+'');	
            if (focus && myRef) {
            	myRef.focus();	
            }
            return myRef;    
}

function urlencode(text) {
	text= text.replace(/\//g,"%2F");
	text= text.replace(/\?/g,"%3F");
	text=  text.replace(/=/g,"%3D");
	text=   text.replace(/&/g,"%26");
	return text;
}



function dumpObj (obj) { // dump objects and contents
	str = '';
	var s = new Array ();
	var i;
	var j = 0;
	for (i in obj) {   // get all objects, and contents
		s[j] = i + ": " + obj[i];
		j = j + 1;
	}
	s.sort ();         // sort them data down
	for (i=0; i<j; i++) {
		str = str + s[i] + "\n";
	}
	return str;
}

function refalse(){ return false; }
<!--<< Smarty fix -->



function BrowserCheck()
{
  var b=navigator.appName;
  if (b=="Netscape") this.b="ns";
  else { if (b=="Microsoft Internet Explorer") this.b="ie"; else this.b=b; }
  this.version=navigator.appVersion;
  this.v=parseInt(this.version);
  
  this.ns=((this.b=="ns") && (this.v>=4));           // "true" falls NS >= 4
  this.ns4=((this.b=="ns") && (this.v==4));
  this.ns5=((this.b=="ns") && (this.v==5));          // Netscape 6
  this.ns6=((this.b=="ns") && (this.v==5));          // Netscape 6
  
  this.ie=((this.b=="ie") && (this.v>=4));           // "true" falls IE >= 4
  this.ie4=(this.version.indexOf('MSIE 4')>0);
  this.ie5=(this.version.indexOf('MSIE 5')>0);
  
  this.pc=(navigator.platform.substring(0,3)=="Win") ? true : false;
  this.mac=(navigator.platform.substring(0,3)=="Mac") ? true : false;

  this.min=(this.ns||this.ie);                      // zugelassene Browser
}

function openResWin( root, p, title, scroll ){
          	var winarg = new Array();
		winarg['height'] = 700;
		winarg['width'] = 850;
		winarg['left'] = 60;
		winarg['top'] = 60;
		winarg['scrollbars'] = scroll;
		title = (title=='')?' ':title;
          	w = openPopUp( root + 'res.php?r='+p + '&title=' + title, 'anfahrt', false, winarg );
          	w.focus();
}

<!--
function rightSize(x,y,dx,dy)
{
 is=new BrowserCheck();	
 if (is.pc)
 {
  if (is.ns4)      { rahmenw=0;  rahmenh=0;}
  else if (is.ns5) { rahmenw=10; rahmenh=18;}
  else if (is.ie)  { rahmenw=10; rahmenh=18;}
 }
 else if (is.mac)
 {
  if (is.ns4)      { rahmenw=0;  rahmenh=0;}
  else if (is.ns5) { rahmenw=0;  rahmenh=4;}
  else if (is.ie)  { rahmenw=0;  rahmenh=4;}
 }
 fh=y+dy+rahmenh;
 fw=x+dx+rahmenw;

 window.resizeTo(fw,fh);
 return;
}

var winarg = new Array();
winarg['height'] = 600;
winarg['width'] = 800;
winarg['left'] = 60;
winarg['top'] = 60;
  
  
  /**
   * opens popup for image-zoom pictures
   */
  function openImgWin( pid, root ){
  	//alert(pid + root);
  	winarg['height'] = 600;
	winarg['width'] = 800;
	winarg['left'] = 60;
	winarg['top'] = 60;
  	//{* js encodes the img link that is used to popup window for security, to protect images*}
  	//{zoomimg pid=$PRODUCT.products_id}
  	w = openPopUp( root + 'img.php?id=' + pid ,'prodimg', false, winarg );
        w.focus();
  }
     
  /**
   * tests if a product can be added to basket
   */       
   function testSubmit(form){
  	//alert("submit this");
  	choose = new Array();
  	//form = document.product;
  	for( i=0; i<form.elements.length ;i++ ){
  		sel = form.elements[i];
  		if( sel.className == "pattrib" ){
  			//alert("sel: " + sel.selectedIndex );
  			if( sel.selectedIndex == 0 ) {
  				choose[choose.length] = sel;
  				
  			}
  		}	
  	}
  	
  	if( choose.length > 0 ){
  		//alert(choose.length);
  		msg = "Bitte erst die passenden Eigenschaften auswählen: \n";
  		for( i=0; i<choose.length ;i++ ){
  			msg += "       - " + choose[i].title + "\n";	
  		}
  		alert(msg);     				
  		choose[0].focus();
  		return false;
  	}
  	return true;
  }
         

function openOptionWin( oid, pid, scroll, root ){
	winarg['height'] = 200;
	winarg['width'] = 300;
	winarg['scrollbars'] = scroll;
	
	w = openPopUp( root + 'prodoptions.php?oid='+oid+'&pid='+pid, 'poptions', false, winarg );
	w.focus();
}
     
          
// -->