var mainImg=new Image();
function MainImg(){
        //this.mainImg=new Image();
        mainImg.src=mainSrc;
        //this.setImg=setImg;
        if(mainImg.complete)setImg();
        else mainImg.onload=setImg;
        //this.preLoad=preLoad;
        //this.preLoad();
        //this.setImg=setImg;
        //this.setImg();
}

function setImg(){
       
         //if(mainImg.loaded) 
                document.getElementById('img_main').src=mainImg.src;
}

function preLoad(){
        this.mainImg.src = mainSrc;
        if(!this.mainImg.complete){
                var images = new Array();
                for (x=0;x<4;x++){
                     images[x]=new Image(); 
                }
                images[0].src="/images/main.jpg";
                images[1].src="/images/aktualnosci.jpg";
                images[2].src="/images/sklad.jpg";
                images[3].src="/images/dyskografia.jpg";
        }
        
        
}



function Tamtaki(){
        //this.antiData=antiData;
        //this.antiData();
        this.newCont=newCont;
        this.fillHTML=fillHTML;
        this.setCont=setCont;
        this.changeCont=changeCont;
        this.build=build;
        this.build();
}

function build(){
       this.newCont(); 
       this.fillHTML();
       this.setCont();
       this.changeCont();
       //setInterval('this.setCont();', 175);
	   window.onresize=function(){this.setCont();};
}

function newCont(){
        var contener=document.createElement('div');
        contener.setAttribute("id","div_contener_js");
        document.body.appendChild(contener);
}

function fillHTML(){
        document.getElementById("div_contener_js").innerHTML=document.getElementById("div_contener").innerHTML;
}

function setCont(){
	if (self.innerWidth)
	{
		frameWidth = self.innerWidth;
		frameHeight = self.innerHeight;
                
	}
	else if (document.documentElement && document.documentElement.clientWidth)
	{
		frameWidth = document.documentElement.clientWidth;
		frameHeight = document.documentElement.clientHeight;
	}
	else if (document.body)
	{
		frameWidth = document.body.clientWidth;
		frameHeight = document.body.clientHeight;
                
	}
	posX =(frameWidth-document.getElementById("div_contener_js").clientWidth)/2;
	posY =(frameHeight-document.getElementById("div_contener_js").clientHeight)/2;
        posY-=50;
	if(posX<0)posX=0;
	if(posY<0)posY=0;
        else if(posY<30)posY=30;
        
        //document.getElementById("div_contener").style.position="absolute";
	document.getElementById("div_contener_js").style.left=posX+"px";
	document.getElementById("div_contener_js").style.top=posY+"px";
        //document.getElementById("div_contener_js").style.visibility="visible";
        
}

function changeCont(){
        document.getElementById("div_contener").style.display="none";
        document.getElementById("div_contener_js").style.visibility="visible";
}


function antiData(){
        //alert(document.getElementById("div_contener").clientWidth);
	lnk= document.createElement("a");
	tekst = "tamtaki" 
			+ "@tamtaki" 
			+ ".com";
	
	lnk.setAttribute("href","mailto:"+tekst.toString());
	tekst = document.createTextNode(tekst);
	lnk.appendChild(tekst);
	pretekst = document.createTextNode("e-mail:");
	document.getElementById("div_footer").appendChild(pretekst);
	document.getElementById("div_footer").appendChild(lnk);
        tekst = document.createTextNode(" phone:"); 
        no = document.createElement("strong")
        no.appendChild(document.createTextNode("+48 "
                                        + "887 "
                                        + "281 "
                                        + "895"));
        document.getElementById("div_footer").appendChild(tekst);
        document.getElementById("div_footer").appendChild(no);
}


