function confirm_msg(err){
	if (!err) {
		gebi("confirm").style.display='none'
		return
	}
	gebi("confirm_msg").innerHTML=err
	gebi("confirm").style.left=document.body.clientWidth/2 - 200
	gebi("confirm").style.display='block'
}
function view_location_img(url, murl, flink, flink1){
	var msg = '<form action="save.php" target="fprocessing"><h2 align="center"><br>Ссылка на фотографию.</h2>';
	msg += '<div id="load_more_link">&nbsp;</div>';
	msg += '</div>';
	msg += '<h2 align="center"><input type="button" value="Закрыть" onClick="confirm_msg()"></h2></form>';
	confirm_msg(msg);
	
	var msg = '';//<h2 align="center"><img src="./images/tb/17-save-a.gif" width="50" height="41"><br>Сохранение фотографии.</h2>';
	msg += '<div id="WindowTxt">1. Ссылка для друзей <br> <input type="text" value="'+(flink1?flink1:url)+'" readonly style="width: 390px;" Onclick="fs(this)"></div>';
	msg += '<div id="WindowTxt">2. Для форумов <br><input type="text" value="' + (murl?"[URL="+flink1+"][IMG]"+murl+"[/IMG][/URL]":"") + '" readonly style="width: 390px;" Onclick="fs(this)"></div>';
	msg += '<div id="WindowTxt">3. Для форумов BBCode<br><input type="text" value="' + (murl?"[url="+flink1+"][img]"+murl+"[/img][/url]":"") + '" readonly style="width: 390px;" Onclick="fs(this)"></div>';
	msg += '<div id="WindowTxt">4. Для блогов (LiveJournal, LiveInternet)<br><input type="text" value=\'' + (murl?'<a target="_blank" href="'+flink1+'"><img src="'+murl+'"></a>':"") + '\' readonly style="width: 390px;" Onclick="fs(this)"></div>';
	msg += '<div id="WindowTxt">5. Для почты и сообщений (ICQ и тд.) <br> <input type="text" value="'+(flink1?flink1:url)+'" readonly style="width: 390px;" Onclick="fs(this)"></div>';
	msg += '<div id="WindowTxt">6. Для сайтов HTML код <br><input type="text" value=\'' + (murl?'<a target="_blank" href="'+flink1+'"><img src="'+murl+'"></a>':"") + '\' readonly style="width: 390px;" Onclick="fs(this)"></div>';
	msg += '<div id="WindowTxt">7. Прямой адрес<br><input type="text" value="'+url+'" readonly style="width: 390px;" Onclick="fs(this)"></div><br />';
//	msg += '<h2 align="center"><input type="button" value="Закрыть" onClick="confirm_msg()"></h2>';
//	confirm_msg(msg);
	gebi('load_more_link').innerHTML = msg;
}
function fs(obj){
  obj.focus();
  obj.select();
}

var gright=220   //отступы справа и снизу
var gbottom=40

var browser=navigator.userAgent.toLowerCase();
var isFF=((browser.indexOf('mozilla')!=-1) && (browser.indexOf('spoofer')==-1) && (browser.indexOf('compatible')==-1) && (browser.indexOf('opera')==-1) && (browser.indexOf('webtv')==-1) && (browser.indexOf('hotjava')==-1));

//var n = (document.layers) ? 1:0;
var n = (isFF) ? 1:0;
var ie = (document.all) ? 1:0;

var pageWidth2, pageHeight2;

function makeObj(obj,nest){
	nest=(!nest) ? '':'document.'+nest+'.'
    this.css=(n) ? eval(nest+'document.'+obj):eval(obj+'.style')
    this.moveIt=b_moveIt;	
}
function b_moveIt(x,y){
	this.x=x;
	this.y=y
	document.getElementById('window').style.left=x;
	document.getElementById('window').style.top=y;
}
function Init(){
	oTest=new makeObj('window');
	//oTest2=new makeObj('confirm');
	pageWidth2=((ie)?document.body.offsetWidth-4:innerWidth)/2-0;
	pageHeight2=((ie)?document.body.offsetHeight-2:innerHeight)/2-150;
//	alert(pageWidth2+" - "+pageHeight2);
	checkIt()
	onresize=resized
	if(ie) window.onscroll=checkIt;
	//alert("FF="+n+"; FF="+isFF+"; IE="+isIE+"; pageWidth2="+pageWidth2+"; pageHeight2="+pageHeight2);
}
function checkIt(){
	if (document.getElementById('window')){
		if(ie){
//			alert((document.body.scrollLeft+pageWidth2-gright) + " " + (document.body.scrollTop+pageHeight2-gbottom));
			oTest.moveIt(document.body.scrollLeft+pageWidth2-gright,document.body.scrollTop+pageHeight2-gbottom);
//			setTimeout("checkIt()",20);		
		}else if(n){
			oTest.moveIt(window.pageXOffset+pageWidth2-gright,window.pageYOffset+pageHeight2-gbottom);
			setTimeout("checkIt()",20)
		}
	}
}

function resized(){
	pageWidth2=((ie)?document.body.offsetWidth-4:innerWidth)/2-0;
	pageHeight2=((ie)?document.body.offsetHeight-2:innerHeight)/2-150;
	if(ie) checkIt()
}
