// JavaScript Document
function getOb(id) { 
	return document.getElementById(id); 
}

function showTab() { 	
	for(var i=0; i<arguments.length; i++) {
		getOb("tab_"+ arguments[i]).style.display="none";
	}
	
	getOb("tab_"+ arguments[0]).style.display="block";
}

function goToURL() { 
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function openBrWindow(theURL,winName,features) {
  newWin = window.open(theURL,winName,features);
  newWin.focus();
}

function jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function getPageSize(){
	var xScroll, yScroll;

	if (window.innerHeight && window.scrollMaxY) {
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}

	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}

	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		myPageHeight = windowHeight;
	} else {
		myPageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){
		myPageWidth = windowWidth;
	} else {
		myPageWidth = xScroll;
	}

	arrayPageSize = new Array(myPageWidth,myPageHeight,windowWidth,windowHeight)
	return arrayPageSize;
}

function confirmation(url) {
	var answer = confirm("Сигурни ли сте, че искате да изтрите разговора?")
	if (answer){
		window.location = url;
	}
}


function confirmation_ignore(url) {
	var answer = confirm("Сигурни ли сте, че искате да блокирате този потребител?")
	if (answer){
		window.location = url;
	}
}

function confirmation_remove_block(url) {
	var answer = confirm("Сигурни ли сте, че искате да отблокирате този потребител?")
	if (answer){
		window.location = url;
	}
}

function confirmation_remove_friend(url) {
	var answer = confirm("Сигурни ли сте, че искате да изтриете този приятел?")
	if (answer){
		window.location = url;
	}
}

function confirmation_remove_me(url) {
	var answer = confirm("Сигурни ли сте, че искате да изтриете собстевения си профил?")
	if (answer){
		window.location = url;
	}
}

function thumbWindow(mypage, myname, w, h,fit_to_screen, imgtoolbar) {
	var props = '';
	var orig_w = w;
	var scroll = '';
	var winl = (screen.availWidth - w) / 2;
	var wint = (screen.availHeight - h) / 2;
	if (winl < 0) { winl = 0; w = screen.availWidth -6; scroll = 1;}
	if (wint < 0) { wint = 0; h = screen.availHeight - 32; scroll = 1;}
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable=no'
	win = window.open('', 'myThumb', winprops)
	win.document.open();
	win.document.write('<html><head>');
	if (imgtoolbar==0) { win.document.write('<meta http-equiv="imagetoolbar" content="false" />'); }
	win.document.write('<scr' + 'ipt type="text/javascr' + 'ipt" language="JavaScr' + 'ipt">');
  	win.document.write("function click() { window.close(); } ");  // bei click  schliessen
  	win.document.write("document.onmousedown=click ");
  	win.document.write('</scr' + 'ipt>');
	win.document.write('<title>'+myname+'</title></head>');
	win.document.write('<body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onBlur="window.close()">');

if (fit_to_screen) {

var ns6 = (!document.all && document.getElementById);
var ie4 = (document.all);
var ns4 = (document.layers);

if(ns6||ns4) {
sbreite = innerWidth - 23;

}
else if(ie4) {
sbreite = document.body.clientWidth - 6;
}

	if (orig_w>sbreite) { rw = 'width='+sbreite;} else {rw = '';}
	win.document.write('<img src="'+mypage+'" alt="'+myname+'" title="'+myname+'" border="0" '+rw+'\></body></html>');
} else {

	win.document.write('<img src="'+mypage+'" alt="'+myname+'" title="'+myname+'" border="0" ></body></html>');
	}

	win.document.close();
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }

}

function emoticon(text) {
	var txtarea = document.message_box.messages_text;
	
	text = ' ' + text + ' ';
	
	if (txtarea.createTextRange && txtarea.caretPos) {
		
	var caretPos = txtarea.caretPos;
	caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
	txtarea.focus();
	
	} else {
		
	txtarea.value += text;
	txtarea.focus();
	
	} 
}


function mydiv_view(divid){
      document.getElementById(divid).style.display = 'block';
 }
 
 function mydiv_hide(divid){ 
      document.getElementById(divid).style.display = 'none';
 }
 
  function mydiv(divid){
    if(document.getElementById(divid).style.display == 'none'){
      document.getElementById(divid).style.display = 'block';
    }else{
      document.getElementById(divid).style.display = 'none';
    }
 }
 
 
function cellImg(idCell, imgName) {
document.getElementById(idCell).style.background = "url(" + imgName + ")";
} 

 