var names = new Array();
names[0] = "O NAS";
names[1] = "OFERTA";
names[2] = "REFERENCJE";
names[3] = "KONTAKT";
names[4] = "KARIERA";      

var files_names = new Array();
files_names[0] = "info.html";
files_names[1] = "oferta.html";
files_names[2] = "referencje.html";
files_names[3] = "kontakt.html";
files_names[4] = "praca.html";

load_page();

function load_links(){
  document.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"skin/mystyle.css\" />");
  document.write("<link rel=\"shortcut icon\" href=\"skin/images/logo.ico\">");
}

function load_page(){

  load_links();
  var page= "<table width=100% class=main align=center cellspacing=0 cellpadding=0 border=0><tr><td>" +
            "<table width=808 class=main1 bgcolor=#FFFFFF align=center cellspacing=0 cellpadding=0 border=0><tr><td>" +
            "<table class=table00 width=800 align=center cellspacing=0 cellpadding=0 border=0><tr><td>" +
			"<table width=100% align=center cellspacing=0 cellpadding=0 border=0><tr><td>" +
			"<table width=800 align=center height=140 cellspacing=0 cellpadding=0 class=table01>" +
			"<tr><td align=center><table width=800 align=center height=140 cellspacing=0 cellpadding=0>" +
			"<tr><td width=200 align=left>" +
            "<object>" +
            "<param name=wmode value=transparent>" +
            "<param name=\"movie\" value=\"skin/logo.swf\">" +
			"<embed src=\"skin/logo.swf\" quality=\"high\" wmode=\"transparent\" width=\"200\" height=\"140\" name=\"logo\"></object>" +
		 	"</td><td class=td01 width=600 align=right>" +
			"<table valign=top><tr><td valign=top height=120 ><div align=right id=\"div01\"></div></td></tr></table>" +
            "</td></tr></table><tr><td class=td02 height=15 width=100%>" +
            "<table align=center width=800><tr><td height=15><div id=div02></div></td></tr></table></td></tr></table></td></tr>" +
		    "<tr><td><table width=100% align=center class=table02 cellspacing=0 cellpadding=0><tr><td width=100%>" +
            "<table width=800 align=center cellspacing=0 cellpadding=0 class=table03>" +
            "<tr><td width=100%><table bgcolor=#F2F2F2 height=100 class=table04 cellspacing=0 cellpadding=0><tr><td>" +
            "<object><param name=\"movie\" value=\"skin/baner.swf\" /><param name=\"quality\" value=\"high\" />" +
            "<param name=\"wmode\" value=\"transparent\" /> " +
            "<param name=\"bgcolor\" value=\"#F2F2F2\" />" +
            "<embed src=\"skin/baner.swf\" quality=\"high\" wmode=\"transparent\" bgcolor=\"#F2F2F2\" width=\"800\" height=\"100\name=\"baner\">" +
            "</object></td></tr></table></td></tr>" +
            "<tr><td><tr><td width=100% align=center>" +
            "<table bgcolor=#F2F2F2 width=100% cellspacing=0 cellpadding=0>" +
            "<tr><td width=25% height=100% valign=top><table width=100% class=table05 height=100%>" +
            "<tr><td valign=top  height=140><table class=table06 align=center><tr><td align=center><div style=\"cursor:pointer; cursor:hand;\" id=div03></div></td></tr>" +
            "</table><tr><td align=center valign=top><div id=div04></div>" +
            "</td></tr></td></tr></table>" +
			"<td class=td23 width=75% bgcolor=#F2F2F2 valign=top><table width=100%><tr><td width=100%><div id=\"div05\"></div></td>" +
            "</tr></table></td><tr></td></tr></table></td></tr></table></td></tr></table>" +
	        "<tr><td><table align=center width=100% cellspacing=0 cellpadding=0 class=table07>" +
	        "<tr><td><div id=\"div06\"></div></td></tr></table></td></tr></table></td></tr></table></td></tr></table></td></tr></table>";
												
  document.write(page);

  //show_date();
  show_menu();
  show_info();
  show_belka();
  show_footer();
}

function include(adres, div_id, name, file_name) {

	if (window.ActiveXObject)
		activxobject1 = new ActiveXObject("Microsoft.XMLHTTP");
	else if (window.XMLHttpRequest)
		activxobject1 = new XMLHttpRequest();
	else
		alert('Twoja przegladarka nie obsluguje AJAX-u');

	activxobject1.onreadystatechange = function() {
		open_page(activxobject1, div_id);
	}
	adres=adres+"?q="+name+"&q1="+file_name;
	activxobject1.open('GET', adres, true);
	activxobject1.send(null);
}

function open_page(activxobject1, div_id) {

	if (activxobject1.readyState == 4) {
		if (activxobject1.status == 200 ||
			window.location.href.indexOf("http") == -1)
			document.getElementById(div_id).innerHTML = activxobject1.responseText;
		else
			document.getElementById(div_id).innerHTML = activxobject1.statusText;
	}
}

function show_menu(){


 text = "<table align=top width=140 class=table08><tr><td><table class=table09 align=center><tr><td width=3 bgcolor=#F2F2F2></td>" +
       "<td align=left bgcolor=#7A9821 style=\"border-bottom: solid 1px #FFFFFF;\" width=130  onclick=\"include('includes/main.php', 'div05' ,'" + names[0] + "','" + files_names[0] + "');\" onmouseover=\"bgColor='#ECECEC';  this.style.color='556B16'; \" onmouseout=\"bgColor='#7A9821'; this.style.color='FFFFFF'; \" >" + names[0] + "</td>" +
       "</tr><tr><td width=5 bgcolor=#FFFFFF></td>" +
       "<td align=left bgcolor=#7A9821 style=\"border-bottom: solid 1px #FFFFFF;\" width=130  onclick=\"include('includes/main.php', 'div05' ,'" + names[1] + "','" + files_names[1] + "');\" onmouseover=\"bgColor='#ECECEC'; this.style.color='556B16'; \" onmouseout=\"bgColor='#7A9821'; this.style.color='FFFFFF'; \" >" + names[1] + "</td>" +
       "</tr><tr><td width=5 bgcolor=#FFFFFF></td>" +
	   "<td align=left bgcolor=#7A9821 style=\"border-bottom: solid 1px #FFFFFF;\" width=130  onclick=\"include('includes/main.php', 'div05' ,'" + names[2] + "','" + files_names[2] + "');\" onmouseover=\"bgColor='#ECECEC'; this.style.color='556B16'; \" onmouseout=\"bgColor='#7A9821'; this.style.color='FFFFFF'; \" >" + names[2] + "</td>" +
       "</tr><tr><td width=5 bgcolor=#FFFFFF></td>" +
       "<td align=left bgcolor=#7A9821 style=\"border-bottom: solid 1px #FFFFFF;\" width=130  onclick=\"include('includes/main.php', 'div05' ,'" + names[3] + "','" + files_names[3] + "');\" onmouseover=\"bgColor='#ECECEC'; this.style.color='556B16'; \" onmouseout=\"bgColor='#7A9821'; this.style.color='FFFFFF'; \" >" + names[3] + "</td>" +
       "</tr><tr><td width=5 bgcolor=#FFFFFF></td>" +
       "<td align=left bgcolor=#7A9821 style=\"border-bottom: solid 1px #FFFFFF;\" width=130  onclick=\"include('includes/main.php', 'div05' ,'" + names[4] + "','" + files_names[4] + "');\" onmouseover=\"bgColor='#ECECEC'; this.style.color='556B16'; \" onmouseout=\"bgColor='#7A9821'; this.style.color='FFFFFF'; \" >" + names[4] + "</td>" +
	   "</tr></table></td></tr></table> ";

 document.getElementById("div03").innerHTML = text;
 include('includes/main.php', 'div05' , names[0], files_names[0]);
}

function show_zamowienie(){
  include('includes/main.html', 'div05' , names[4], files_names[4]);
}

function show_info()
{
  text="<br/><table align=center width=142 cellspacing=0 cellpadding=0 border=0>" +
       "<tr><td height=24 align=center background=skin/images/tel.jpg><div id=div07><B>&nbsp;Zadzwoń do nas:</B></div></td></tr><tr>" +
	   "<td><table align=center width=120><tr><td align=center class=td05>•&nbsp;662-093-364</td></tr>" +
       "<tr><td align=center class=td05>•&nbsp;501-342-712</td></tr><td align=center class=td05>•&nbsp;516-495-703</td></tr></table></td></tr></table>" +
       "<br/><table align=center width=142 cellspacing=0 cellpadding=0 border=0>" +
       "<tr><td  height=24 align=center background=skin/images/tel.jpg><div id=div_tel><B>&nbsp;Napisz do nas:</B></div></td></tr></tr><tr><td align=center><a href=\"javascript:show_zamowienie()\"> złóż zamówienie online</a></td></tr><tr><td><br/></td></tr></table>";

  document.getElementById("div04").innerHTML = text;
}

function show_belka()
{
  text = "<table class=table10 align=right><tr><td><B>GEODEZJA</B></td><td><img src=\"skin/images/ico1.jpg\" alt=\"geodeta Kraków, geodezja, geodeta malopolska,geodezja Kraków, usługi geodezyjne, terenie Krakowa\"></img></td>" +
         "<td><B>PROJEKTY - REALIZACJA</B></td><td><img src=\"skin/images/ico1.jpg\" alt=\"geodeta Kraków, geodezja, geodeta malopolska,geodezja Kraków, usługi geodezyjne, terenie Krakowa\"></img></td>" +
	 "<td><B>INWESTYCJE</B></td></tr></table>";
	 
  document.getElementById("div02").innerHTML = text;
}

function show_date(){
  
  var currentTime = new Date()
  var month = currentTime.getMonth() + 1
  var day = currentTime.getDay()
  var day1 = currentTime.getDate();
  var year = currentTime.getFullYear()
  switch(day){
    case 0: day="Niedziela"; break;
    case 1: day="Poniedziałek"; break;
    case 2: day="Wtorek"; break;
    case 3: day="Środa"; break;
    case 4: day="Czwartek"; break;
    case 5: day="Piątek"; break;
    case 6: day="Sobota"; break;
  }

  if(day1<10) day1 = "0" + day1;
  if(month<10) month = "0" + month;

  var date = day + "," + " " + day1 + "." + month + "." + year;
  document.getElementById("div01").innerHTML = date;
}

function show_footer(){

  var footer_text = "<table width=100% cellspacing=0 cellpadding=0><tr><td><table class=table11 cellspacing=0 cellpadding=0 align=left>" +
                "<tr><td>ul.Siewna 30</td></tr>" +
                "<tr><td>31-231 Kraków</td></tr>" +
			    "<tr><td>NIP: 9452103163</td></tr></table></td>" +
			    "<td valign=bottom align=right><table class=table11 cellspacing=0 cellpadding=0><tr>" +
				"<td align=right>Email: mapa@gpi-geodezja.pl</td></tr>" +
				"<td>Nr konta: 97102029060000180201889260</td></tr></td></tr></table>";
  document.getElementById("div06").innerHTML = footer_text;
}

function makevisible(cur,which)
{
	strength=(which==0)? 1 : 0.7
	if (cur.style.MozOpacity)
	{
		cur.style.MozOpacity=strength
	}
	else if (cur.filters)
	{
		cur.filters.alpha.opacity=strength*100
	}
}

function showImage(x)
{
    url = "data/images/img" + x + ".jpg";
	newWindow = window.open("","","width=1116,height=1541,scrollbars=yes");
    newWindow.document.write("<title>Referencje</title>");
	newWindow.document.write("<BODY bgcolor=#000000 LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>");
	newWindow.document.write("<table width=100% border=0 cellspacing=0 cellpadding=0 height=100%><tr><td style=\"cursor:pointer; cursor:hand;\" onclick=\"window.close();\" align=center valign=middle><img src="+ url +" border=0></td></tr></table>");
	newWindow.document.write("</BODY>");
	newWindow.document.close();	
	newWindow.focus();
}