function urlencode(str) {
    str = escape(str);
    str = str.replace('+', '%2B');
    str = str.replace('%20', '+');
    str = str.replace('*', '%2A');
    str = str.replace('/', '%2F');
    str = str.replace('@', '%40');
    return str;
}

function spausdinti(img){

    var newImg = new Image();
    newImg.src = img.src;
    var height = newImg.height;
    var width = newImg.width;
    
    winOpen('http://www.seimosvaistine.lt/print.php?img='+urlencode(img.src),'',width,height);

}

function send(){
    winOpen('http://www.seimosvaistine.lt/send.php?url='+document.URL,'',500,400)
}

function winOpen(URL, windowName, width, height/*, resizable, location, menubar, scrollbars, status, toolbar*/){
	var windowFeatures;
	windowFeatures = '';
	if (width != '' && width != null){
		windowFeatures = windowFeatures+'width='+width+',';
	}
	if (height != '' && height != null){
		windowFeatures = windowFeatures+'height='+height+',';
	}
	
	var swidth = screen.width;
	var sheight = screen.height;
	
	var left = (swidth-width)/2;
	var top = (sheight-height)/2;
	
	windowFeatures = windowFeatures+'left='+left+',top='+top+',';
	/*
	if (resizable){
		windowFeatures = windowFeatures+'resizable,';
	}
	if (location){
		windowFeatures = windowFeatures+'location,';
	}
	if (menubar){
		windowFeatures = windowFeatures+'menubar,';
	}
	if (scrollbars){
		windowFeatures = windowFeatures+'scrollbars,';
	}
	if (status){
		windowFeatures = windowFeatures+'status,';
	}
	if (toolbar){
		windowFeatures = windowFeatures+'toolbar,';
	}*/
	var wd = window.open(URL, windowName, windowFeatures);
	wd.document.close();

}
