
function popup(url,opt1)
{
	var newwindow;
	if (opt1=='nd') 
	{
		newwindow=window.open(url,'','top=220, left=320, menubar=no,location=no, width=530, height=355,scrollbars=yes');
	}
	else if (opt1=='in') 
	{
		newwindow=window.open(url,'','top=200, left=300, menubar=no,location=no, width=330, height=200');
	}
	else if (arguments[2]=='fullscreen' && screen.availWidth)
	{
		newwindow = window.open(url,"",'left=0,top=0,width='+screen.availWidth+',height='+screen.availHeight+',scrollbars=auto,fullscreen=yes');
		newwindow.location = adr;  
	}
	else
	{
		newwindow=window.open(url,'','top=50, left=50, menubar=no,location=no, fullscreen=yes');
	}
	
	if (window.focus) {newwindow.focus()}
}

function fullsreen (adr) {
   var winwidth = screen.availWidth;
   var winheight = screen.availHeight;

if (document.all) {
   var doit = window.open("","",'left=0,top=0,width='+winwidth+',height='+winheight+',scrollbars=auto,fullscreen=yes');
   doit.location = adr;
} else {
   var doit = window.open("","",'left=0,top=0,width='+winwidth+',height='+winheight+',scrollbars=auto,fullscreen=yes');
   doit.location = adr;   }
}

function favoriti ()
{
	nosaukums = "Feini! Interaktīvs domājošs portāls";
	adr = "http://www.feini.lv";
	if (window.sidebar) 
	{ //  Firefox 
		window.sidebar.addPanel(nosaukums, adr,"");
	} 
	else if ( window.external ) 
	{ // IE
		window.external.AddFavorite( adr, nosaukums); 
	}
	else if (window.opera && window.print) 
	{ // Opera 
		var mbm = document.createElement('a');
		mbm.setAttribute('rel','sidebar');
		mbm.setAttribute('href',adr);
		mbm.setAttribute('title',nosaukums);
		mbm.click();
	}
}

function homepage ()
{
	adr = "http://www.feini.lv";
	if (document.all)
	{
		document.body.style.behavior='url(#default#homepage)';
		document.body.setHomePage(adr);
	}
	else
    {
		alert ("Atvainojiet. Jums mājaslapa jāiestāda manuāli!");
    }
}

function ja_ne (teksts,adrese,els_adr)
{
	if (confirm(teksts)) 
	{
		document.location = adrese;
	}
	else if (els_adr)
	{
		document.location = els_adr;
	}
}

function td_hid_show (id,act)
{
	td = 'ip_'+id;
	td_symb = 'ip_symb_'+id;
	if (act=='pl')
	{
		window.document.getElementById(td).style.visibility='visible';
		window.document.getElementById(td_symb).innerHTML='<img src=\'../i/minus.jpg\' style=\"cursor:crosshair\"; onClick=\"td_hid_show(\''+id+'\',\'mn\');\">';
	}
	else if (act=='mn')
	{
		window.document.getElementById(td).style.visibility='hidden';
		window.document.getElementById(td_symb).innerHTML='<img src=\'../i/plus.jpg\' style=\"cursor:crosshair\"; onClick=\"td_hid_show(\''+id+'\',\'pl\');\">';
	}
}

function mOver1(id, _class) 
{
	document.getElementById(id).className=_class;
}
function mOut1(id, _class) 
{
	document.getElementById(id).className=_class;
}

function checka_val (lauks,indeks)
{
	if (indeks=='check')
	{
		if (arguments[2]=='rev')
		lauks.checked = false;
		else
		lauks.checked = true;
	}
	else
	{
		lauks[indeks].checked = true;
	}
}

function windimmensions() 
{
	var windowHeight, windowWidth, scrolly, scrollx;
	windowHeight = window.innerHeight != null ? window.innerHeight : document.documentElement && document.documentElement.clientHeight ? document.documentElement.clientHeight:document.body != null ? document.body.clientHeight : null;
	windowWidth  = window.innerWidth  != null ? window.innerWidth  : document.documentElement && document.documentElement.clientWidth  ? document.documentElement.clientWidth:document.body  != null ? document.body.clientWidth  : null;
	if (window.innerWidth) //if browser supports window.innerWidth
	{
		scrollx = window.pageXOffset;
		scrolly =  window.pageYOffset;
	}
	else if (document.all) //else if browser supports document.all (IE 4+)
	{
		scrollx =  document.body.scrollLeft;
		scrolly =  document.body.scrollTop;
	}
	return [windowWidth,windowHeight,scrollx,scrolly];
}


function closeBox(divs) 
{
    window.document.getElementById(divs).style.display = "none";
}
function loadMsg(divs,txt) 
{
	 var m_top;
	 var m_left;
	 var WinSize;
	 WinSize = windimmensions();
	 m_top = WinSize[3]+WinSize[1]/2-50+"px";
	 m_left = WinSize[0]/2-160+"px";
	 //disable_all();	 
	 window.document.getElementById(divs).style.top=m_top;
	 window.document.getElementById(divs).style.left=m_left;
	 window.document.getElementById(divs+'_txt').innerHTML=txt;
     document.getElementById(divs).style.display = "block";
}
            
function disable_all () 
{       
	var elem = document.getElementById('b_table');
	elem.className = 'POP_LAYER';
	return true;
}
function insert_smile(img)
{
	window.iWin.focus();
	if_body = window.iDoc.getElementById('i_body').innerHTML;
	if (window.isGecko)
	{
		if (if_body.substr(0,4)=='<br>') if_body = if_body.substr(4);
		// ar sho kursors uz ff nostaajas beigaas
		window.iWin.document.execCommand('inserthtml', false, '<img src='+img.src+'>');
	
	}
	//window.iWin.document.insertHTML('<img src='+img.src+'>'); 
	// uz IE ar range
	else 
	{
		window.iDoc.getElementById('i_body').innerHTML = if_body+'<img src=\''+img.src+'\'>';
		var oSel = iDoc.selection.createRange ();
		oSel.moveStart ('character', if_body.length);
		oSel.moveEnd ('character', 0);
		oSel.select ();
	}
	window.pastesmile = true;
}



function disableSelection(target)
{
if (typeof target.onselectstart!="undefined") //IE route
	target.onselectstart=function(){return false}
else if (typeof target.style.MozUserSelect!="undefined") //Firefox route
	target.style.MozUserSelect="none"
else //All other route (ie: Opera)
	target.onmousedown=function(){return false}
target.style.cursor = "default"
}