function v( f )
{
	
	lo( 'mPhoto', f );
	
}

function v1( f, w, h )
{
	document.getElementById( 'idWidth' ).value 	= w;
	document.getElementById( 'idHeight' ).value = h;
	document.getElementById( 'idUrl' ).value	= '/popup/photo/?p=' + f;
	lo( 'mPhoto', f );	
}

function ImageLoader(id,url){
    this.i = new Image();
 
    this.id = id;
    this.url = url;
    this.rand = Math.floor(Math.random()*100000000000); //cache verhindern
    this.imEl=document.getElementById(id);

    this.loadImage = function(){
		objRef=this;
        this.i.src=this.url+'?r='+this.rand;
        objRef.waitForImage();
    };
    
    this.waitForImage = function(){
        if(objRef.i.complete){
            objRef.imEl.src=this.i.src;
        }else{
            setTimeout('objRef.waitForImage()', 100);
        }    
    };
}
function lo(id,url)
{
    document.getElementById( id ).src = url;
} 

function op(url, w, h) 
{
	window.open(url, '', 'toolbar=no,menubar=no,scrollbars=0, resizable=no,status=no,location=no,directories=no,top=150,left=150,fullscreen=no,height=' + h + ',width=' + w);	
}

function op1() 
{
	window.open( document.getElementById( 'idUrl' ).value, '', 'toolbar=no,menubar=no,scrollbars=0, resizable=no,status=no,location=no,directories=no,top=150,left=150,fullscreen=no,height=' + document.getElementById( 'idHeight' ).value + ',width=' + document.getElementById( 'idWidth' ).value );	
}

function checkQuestionPriceForm()
{	
	if( document.getElementById( 'idName' ).value == '' )
	{
		alert( 'Proszę podać imię lub nazwę firmy.' );
		return false;
	}
	
	if( document.getElementById( 'idEmail' ).value == '' && document.getElementById( 'idPhone' ).value == '' )
	{
		alert( 'Proszę podać e-mail lub numer telefonu.' );
		return false;
	}
	
	if( document.getElementById( 'idPrice' ).value == '' )
	{
		alert( 'Proszę podać cene.' );
		return false;
	}
	
	return true;
}

function sendQuestionPrice()
{
	if( checkQuestionPriceForm() )
	{
		document.getElementById( 'idForm' ).submit();
	}
}

function checkOpinionForm()
{	
	if( document.getElementById( 'idName' ).value == '' )
	{
		alert( 'Proszę podać imię lub nazwę firmy.' );
		return false;
	}
	
	if( document.getElementById( 'idOpinion' ).value == '' )
	{
		alert( 'Proszę podać swoją opinie.' );
		return false;
	}
	
	return true;
}

function sendOpinion()
{
	if( checkOpinionForm() )
	{
		document.getElementById( 'idForm' ).submit();
	}
}

function checkQuestionForm()
{	
	if( document.getElementById( 'idName' ).value == '' )
	{
		alert( 'Proszę podać imię lub nazwę firmy.' );
		return false;
	}
	
	if( document.getElementById( 'idEmail' ).value == '' && document.getElementById( 'idPhone' ).value == '' )
	{
		alert( 'Proszę podać e-mail lub numer telefonu.' );
		return false;
	}
	
	if( document.getElementById( 'idQuestion' ).value == '' )
	{
		alert( 'Proszę podać treść pytania.' );
		return false;
	}
	
	return true;
}

function sendQuestion()
{
	if( checkQuestionForm() )
	{
		document.getElementById( 'idForm' ).submit();
	}
}
