
function open_win(url){
	new_win = open(url, "", "width=600,height=400,status=yes,toolbar=no,menubar=no,scrollbars=yes");
}

function show_video(fn){
	new_win = open("video.html?video_file=" + fn, "", "width=660,height=480,status=no,toolbar=no,menubar=no,scrollbars=no");
}


var expDays = 7;


function getCookieVal(offset) {
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1)
	endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}


function GetCookie (name) {  
	var arg = name + "=";  
	var alen = arg.length;  
	var clen = document.cookie.length;  
	var i = 0;  
	while (i < clen) {    
		var j = i + alen;    
		if (document.cookie.substring(i, j) == arg) return getCookieVal (j);    
		i = document.cookie.indexOf(" ", i) + 1;    
		if (i == 0) break;   
	}  
	return null;
}
function SetCookie (name, value) {  
	var argv = SetCookie.arguments;  
	var argc = SetCookie.arguments.length;  
	var expires = (argc > 2) ? argv[2] : null;  
	var path = (argc > 3) ? argv[3] : null;  
	var domain = (argc > 4) ? argv[4] : null;  
	var secure = (argc > 5) ? argv[5] : false;  
	document.cookie = name + "=" + escape (value) + 
	((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
	((path == null) ? "" : ("; path=" + path)) +  
	((domain == null) ? "" : ("; domain=" + domain)) +    
	((secure == true) ? "; secure" : "");
}



function DeleteCookie (name) {  
	var exp = new Date();  
	exp.setTime (exp.getTime() - 1);  
	var cval = GetCookie (name);  
	document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}


var exp = new Date(); 
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));


function set_jspos(scale, x, y){
	
	if(GetCookie('scale') == null) DeleteCookie('scale');
	SetCookie('scale',scale * 1,exp);
	
	if(GetCookie('x') == null) DeleteCookie('x');
	SetCookie('x',x * 1, exp);
	
	if(GetCookie('y') == null) DeleteCookie('y');
	SetCookie('y',y * 1,exp);
	
	//alert('ok\'s! :) ' + scale + ' - ' + x + ' - ' + y + ' - ');
}


function show_img(url, name){
	img_win = open("", "", "width=400,height=400,status=no,toolbar=no,menubar=no,scrollbars=no");
	img_win.document.open();
	img_win.document.write('<html><head></head><body topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">' + "\n");

	img_win.document.write('<script language="JavaScript">' + "\n");	
	img_win.document.write('function ws(){' + "\n");
	img_win.document.write('window.resizeTo(document.bimg.width, document.bimg.height + 80);' + "\n");
	img_win.document.write('}' + "\n");
	img_win.document.write('</script>' + "\n");
	img_win.document.write('<img name="bimg" src="'+ url + '" onLoad="ws();">');
	img_win.document.write('</body></html>' + "\n");
	img_win.document.close();
}

