
function imgSrc(obj, src){
    obj.src = src;
}
/**
 * Skacze do podnaego adresu
 * @param {Object} adres
 */
function jump(adres){
    parent.location.href = adres;
}

function isValidEmail(){
    if(echeck(document.forms['newsletter'].elements['email'].value)){
        document.forms['newsletter'].submit();    
    }
}


function echeck(str) {
	var at="@";
	var dot=".";
	var lat=str.indexOf(at);
	var lstr=str.length;
	var ldot=str.indexOf(dot);
    var error = "To nie jest poprawny adres email";
	if (str.indexOf(at)==-1){
	   alert(error);
	   return false;
	}

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	   alert(error);
	   return false;
	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
	    alert(error);
	    return false;
	}

	 if (str.indexOf(at,(lat+1))!=-1){
	    alert(error);
	    return false;
	 }

	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
	    alert(error);
	    return false;
	 }

	 if (str.indexOf(dot,(lat+2))==-1){
	    alert(error);
	    return false
	 }
	
	 if (str.indexOf(" ")!=-1){
	    alert(error);
	    return false
	 }
    return true					
}
/*
function onResize(){return;
    var mainContent = document.getElementById('mainContent');
    var windowWidth = clientWidthArea();
    if(windowWidth > 990){
        mainContent.style.marginLeft = parseInt((windowWidth-990)/2)+'px'; 
    }else{
        mainContent.style.marginLeft = '0px';
    }
}
*/

function onLoad(){
    //onResize();
    var contentPanel = document.getElementById('contentCenter');
    if(contentPanel == null){
        return false;
    }
    
    if(contentPanel.offsetHeight){
        var h = 83-((contentPanel.offsetHeight+20)%83);
        contentPanel.style.height = (contentPanel.offsetHeight+h)+'px';
    }else{
        return false;
    }
}

function clientHeightArea(){
    return (typeof(window.innerHeight)=='number')?window.innerHeight:( document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight ) )? document.documentElement.clientHeight:(document.body && (document.body.clientWidth || document.body.clientHeight ) )?document.body.clientHeight:0;
}

function clientWidthArea(){
    return myWidth=(typeof(window.innerWidth)=='number')?window.innerWidth:(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight ) )? document.documentElement.clientWidth:(document.body && (document.body.clientWidth || document.body.clientHeight))?document.body.clientWidth:0;
}

function openWindow(link, w, h){
    var oWindow = window.open(link, null, 'toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=yes,width='+w+',height='+h+',left=200' ) ;
    if(oWindow.focus) {
        oWindow.focus();
    }
}