function center(){
//if (document.documentElement.clientWidth > 960) {javascript:void(center_Width())} 
//if (document.documentElement.clientWidth <= 960) {document.getElementById('container').style.left = "0px"}
if (document.documentElement.clientHeight > 640) {javascript:void(center_Height())} 
if (document.documentElement.clientHeight <= 640) {document.getElementById('container').style.top = "0px"}
}

function center_Height() {
		document.getElementById('container').style.top = (((document.documentElement.clientHeight - 640)/2)-20) + "px";
		//alert((((document.documentElement.clientHeight - 740)/2)) + "px")
		}
		
function center_Width() {
		document.getElementById('container').style.left = (((document.documentElement.clientWidth - 960)/2)-20) + "px";
}

var tmp
var tmp_old

function change_gif(tmp) {
	 document.getElementById('item'+tmp).style.background= 'url("obrazy/'+tmp+'_.gif") no-repeat center';
	 document.getElementById('item'+tmp).style.backgroundPosition= "50% 10px";
	 if (tmp_old > 0 && tmp_old != tmp){
	 document.getElementById('item'+tmp_old).style.background= 'url("obrazy/'+tmp_old+'.gif") no-repeat center';
	 document.getElementById('item'+tmp_old).style.backgroundPosition= "50% 10px";
	 }
	 tmp_old= tmp
}




//nowe<div></div>
function menu_slide(){
	$("#topnav li").prepend("<span></span>"); //Throws an empty span tag right before the a tag
	
	$("#topnav li").each(function() { //For each list item...
		var linkText = $(this).find("a").html(); //Find the text inside of the a tag
		$(this).find("span").show().html(linkText); //Add the text in the span tag
	}); 
	
	$("#topnav li").hover(function() {	//On hover...
		$(this).find("span").stop().animate({ 
			marginTop: "-40" //Find the span tag and move it up 40 pixels
		}, 250);
	} , function() { //On hover out...
		$(this).find("span").stop().animate({
			marginTop: "0" //Move the span back to its original state (0px)
		}, 250);
	});
}

//kontakt formularz

function createRequestObject() {
    var ro;
    var browser = navigator.appName;
    if(browser == "Microsoft Internet Explorer"){
        ro = new ActiveXObject("Microsoft.XMLHTTP");
    }else{
        ro = new XMLHttpRequest();
    }
    return ro;
}

var http = createRequestObject();
function sendemail() {
 var msg = document.contactform.msg.value;
 var name = document.contactform.name.value;
 var email = document.contactform.email.value;
 var subject = document.contactform.subject.value;
 document.contactform.send.disabled=true;
 document.contactform.send.value='Sending....';
    http.open('get', 'contact.php?msg='+msg+'&name='+name+'&subject='+subject+'&email='+email+'&action=send');
    http.onreadystatechange = handleResponse;
    http.send(null);
}

function handleResponse() {
    if(http.readyState == 4){
        var response = http.responseText;
        var update = new Array();
        if(response.indexOf('|' != -1)) {
            update = response.split('|');
            document.getElementById(update[0]).innerHTML = update[1];
        }
    }
}

