var mainIdA = "trans";
var winWidthA;
var winHeightA;
var currScrollPositionA;
var imgDirA = "img/win/";

function getAuthorWinSize() 
{
  if (typeof(window.innerWidth ) == 'number')
  {
    //Non-IE
    this.winWidthA = window.innerWidth;
    this.winHeightA = window.innerHeight + window.scrollMaxY;
	this.currScrollPositionA = window.pageYOffset;
  } 
  else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) 
  {
    //IE 6+ in 'standards compliant mode'
	this.winWidthA = document.documentElement.scrollWidth;
    this.winHeightA = (document.documentElement.scrollHeight);
	this.currScrollPositionA = document.documentElement.scrollTop;
  }
  else if (document.body && (document.body.clientWidth || document.body.clientHeight)) 
  {
    //IE 4 compatible
    this.winWidthA = document.body.scrollWidth;
    this.winHeightA = document.body.scrollHeight;
	this.currScrollPositionA = document.body.scrollTop;
  }
}

function scrollToTop()
{
	scroll(0, 0);
}

function makeAuthorMask()
{
	getAuthorWinSize();
	
	myDiv = document.getElementById(mainIdA);
	myDiv.style.display = "block";

	myDiv.style.width = this.winWidthA+"px";
	myDiv.style.height = this.winHeightA+"px";
	
	scrollToTop();
}
function removeAuthorMask()
{
	document.body.removeChild(document.body.lastChild);
	
	myDiv = document.getElementById(mainIdA);
	myDiv.style.display = "none";

	myDiv.style.width = "0%";
	myDiv.style.height = "0%";
}

function createNewAuthorDiv(contentDiv, width, height)
{
	getAuthorWinSize();
	var divTag = document.createElement("div");
	divTag.id = "winDiv";
	divTag.setAttribute("align", "center");
	divTag.style.margin = "0px auto";
	divTag.style.position = "absolute";
	divTag.style.display = "block";
	divTag.style.top = "80px";
	divTag.style.zIndex = "1000";
	divTag.style.left = (this.winWidthA/2 - width/2)+"px";
	divTag.style.width = width+"px";
	divTag.style.height = height+"px";
	
	divTag.innerHTML = createWinAuthorBorder(contentDiv, (height-75));
	
	document.body.appendChild(divTag);
}
function createWinAuthorBorder(contentDiv, height)
{
	var bgColor = "#77a3ee";
	var html = "<table width='100%' border='0' cellpadding='0' cellspacing='0'>";
	html += "<tr><td width='15px' height='14px'><img align='absbottom' src='" + imgDirA + "win_top_l.gif'></td>";
	html += "<td width='100%' height='14px' id='winTop'>&nbsp;</td>";
	html += "<td width='15px' height='14px'><img align='absbottom' src='" + imgDirA + "win_top_r.gif'></td></tr>";
	html += "<tr><td width='15px' id='winLeft'>&nbsp;</td>";
	html += "<td width='100%' style='padding: 5px;' valign='top' id='"+contentDiv+"' height='"+height+"' bgColor='"+bgColor+"'>"+ createAuthorContent() +"</td>";
	html += "<td width='15px' id='winRight'>&nbsp;</td></tr>";
	html += "<tr><td width='15px' height='14px'><img align='absbottom' src='" + imgDirA + "win_bot_l.gif'></td>";
	html += "<td width='100%' height='14px' id='winBottom'>&nbsp;</td>";
	html += "<td width='15px' height='14px'><img align='absbottom' src='" + imgDirA + "win_bot_r.gif'></td></tr>";
	html += "</table>";
	return html;
}

function showAuthor()
{
	makeAuthorMask();	
	createNewAuthorDiv("sa", 350, 200);
}
function createAuthorContent()
{
	var html = "<div id='winHeader' align='left'>O AVTORJU</div><br>";
	html += "<div align='center'>Andrej Pogačnik<br>";
	html += "<b>Stran narejena z:</b><br>";
	html += "PHP & MySQL<br>";
	html += "AJAX<br>";
	html += "<hr color='#ffffff'>";
	html += "Spletna stran: <a href='http://www.turby-on.net' target='_blank'>www.turby-on.net</a><br><br>";
	html += "<input type='button' name='cancel' value='Zapri okno' id='btns' onclick='removeAuthorMask();'></div>";	
	return html;
}