
function checkParent()
{
	// alert(parent.window.location.href);
	
	if (parent.window.location.href	!= window.location.href)
	{
		parent.window.location.href	= window.location.href;	
	}
	
	// parent.window.location.href	= window.location.href;
}

function setPointer(theRow, thePointerColor)
{
	if (thePointerColor == '' || typeof(theRow.style) == 'undefined') {return false;}
	if (typeof(document.getElementsByTagName) != 'undefined') {var theCells = theRow.getElementsByTagName('td');}
	else if (typeof(theRow.cells) != 'undefined') {var theCells = theRow.cells;}
	else {return false;}
	var rowCellsCnt  = theCells.length;
	for (var c = 0; c < rowCellsCnt; c++) {theCells[c].style.backgroundColor = thePointerColor;}
	return true;
}
			
function setCookie( name, value ) 
{
	var systemDate = new Date(); 
	
	var expareDate = new Date(systemDate.getTime() + 315360000000);
	
	document.cookie = name + "=" + escape(value) + "; path=" + '/' + "; expires=" + expareDate.toGMTString();
}

function getCookie( name ) 
{
	var dc = document.cookie;
	
	var prefix = name + "=";
	
	var begin = dc.indexOf("; " + prefix);
	
	if (begin == -1)
	{
		begin = dc.indexOf(prefix);
		
		if (begin != 0) return null;
	} 
	else begin += 2;
	
	var end = document.cookie.indexOf(";", begin);
	
	if (end == -1) end = dc.length;
	
    return unescape(dc.substring(begin + prefix.length, end));
}

function popup( adresas, name, width, height ) 
{ 
	left = ((screen.width-width.replace('width=', ''))/2);
	
	topx = ((screen.height-height.replace('height=', ''))/2) - 40;
	
	newwindow=window.open(""+adresas+"", name,""+width+","+height+", toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,copyhistory=no,resizable=yes, top="+topx+", left="+left+""); 
	
	// newwindow=window.open(""+adresas+"", name,""+width+","+height+", toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,copyhistory=no,resizable=yes,left="+((screen.width-width)/2)+",top="+((screen.height-height)/2))+""); 
	
	if (window.focus) {newwindow.focus()}
}

/* -- External link -- */

function externalLinks() 
{
	if (!document.getElementsByTagName) return;
	
	var anchors = document.getElementsByTagName("a");
	
	for (var i=0; i<anchors.length; i++) 
	{
		var anchor = anchors[i];
		
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") anchor.target = "_blank";
	}
}

window.onload = externalLinks;

function showBox_save( boxId )
{
    var myBox = document.getElementById( boxId );

    if ( myBox.style.display == 'none' )
    {
    	setCookie( boxId + '_divBox', 'block' );
    
        myBox.style.display = 'block';
    } 
    else 
    {
    	setCookie( boxId + '_divBox', 'none' );
    
        myBox.style.display = 'none';
    }
}

function showBox( boxId, show )
{
    var myBox = document.getElementById( boxId );

    if ( show == 'TRUE' )
    {
        myBox.style.display = 'block';
        
        myBox.style.visibility="visible";
    } 
    else 
    {
        myBox.style.display = 'none';
        
        myBox.style.visibility="hidden";
    }
}

function setPause( millis )
{
	var date = new Date();
	
	var curDate = null;
	
	do { curDate = new Date(); }
	
	while(curDate-date < millis);
}

function flash( src, width, height )
{
    document.write(
        '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"' + (width ? ' width="'+width+'"' : '') + (height ? ' height="'+height+'"' : '') + ' id="padidintas" align="middle">' + "\n" +
        '    <param name="allowScriptAccess" value="sameDomain" />'+ "\n" +
        '    <param name="movie" value="'+src+'" />'+ "\n" +
        '    <param name="quality" value="high" />'+ "\n" +
        '    <embed src="'+src+'" quality="high"' + (width ? ' width="'+width+'"' : '') + (height ? ' height="'+height+'"' : '') + ' name="padidintas" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />' + "\n" +
        '</object>'
    );
}