function metaCreate(id,link){
    var str = $(id).value;
    
 	   	new Ajax.Request(link, {
        method: 'post',
        onSuccess: function(transport){
       var response = transport.responseText || "no response text";
       $('url').value = response 
    },
    onFailure: function(){  }
    });
     
    $('title').value = $(id).value;    
    return true
}


function showup(id)
{
	if (lightbox == 0)
	{
		scroll(0,0)
		Effect.BlindDown(id);
		lightbox = 1;
	}
	else
	{
		showdown(id);
		
	}
	
}

function showdown(id)
{
	Effect.BlindUp(id)
	lightbox = 0;
}


function metaCreateS2(){
    var str = $('name').value;
    $('title').value = $('title_min').value;
    $('keywords').value = $('title_min').value;
    $('description').value = $('title_min').value;
    
    return true    
}


function AjaxQuery(param1,param2)
{
		/*$('ajaxMessage').innerHTML=''*/
		new Ajax.Updater(param1, param2, {
        method: 'post'
    });
    
  var brokenstring=param2.split("/"); 
    
    if (param1 == 'group' && brokenstring[5] == 'kraj' && brokenstring[6] != '0')
    {
    
        $('osobiscie').style.display = 'none';
        $('karta').setAttribute("class", "noborder");
    }
    else if(param1 == 'group' && brokenstring[5] == 'kraj' && brokenstring[6] == '0')
    {
        $('osobiscie').style.display = 'block';
        $('karta').setAttribute("class", "");
    }
}

function AjaxQuery2(param1,param2,param3)
{
		$(param1).innerHTML='<img style="margin-top:20px" src="/public/images/front/loader.gif" /><br /><br />'
		new Ajax.Updater(param1, param2, {
        method: 'post'
    });
    
    	if (param3 != '0')
    	{
    	
    		$(param1 + 'HTML').style.top = document.viewport.getScrollOffsets().top + 'px'
    		$(param1 + 'HTML').style.display="block"
    	}
}

function zamknij()
{
	$('popupHTML').style.display="none";
	$('popup').innerHTML = '';
}



/*
Funkcja realizująca zapytania ajaxowe

Jeśli odpowiedź funkcji pytanej wynosi "true" brak komunikatu.

*/
function AjaxRequst(link)
{
	
	new Ajax.Request(link, {
        method: 'post',
        onSuccess: function(transport){
       var response = transport.responseText || "no response text";
       $('ajaxMessage').innerHTML = response 
       $('ajaxMessage').style.display="block"
       $('ajaxMessage').fade({ duration: 2.0, from: 1, to: 0 });

    },
    onFailure: function(){ alert('Something went wrong...') }
    });
    
    /*jeśli odpowiedź funkcji jest nieprawidłowa wyświetl komunikat*/
    return true;
}


function AjaxRequstTo(link,name)
{
    
    new Ajax.Request(link, {
        method: 'post',
        onSuccess: function(transport){
       var response = transport.responseText || "no response text";
       $(name).innerHTML = response 
       $(name).style.display="block"
    },
    onFailure: function(){ alert('Something went wrong...') }
    });
    
    /*jeśli odpowiedź funkcji jest nieprawidłowa wyświetl komunikat*/
    return true;
}


function AjaxRequestNone(link)
{
	
	new Ajax.Request(link, {
        method: 'post',
        onSuccess: function(transport){
    },
    onFailure: function(){ alert('Something went wrong...') }
    });
    
    /*jeśli odpowiedź funkcji jest nieprawidłowa wyświetl komunikat*/
    return true;
}

function st(text)
{
 return overlib(text);
}


function stajax(link,text)
{
	var textajax = 0
	new Ajax.Request(link, {
        method: 'post',
        onSuccess: function(transport){
      var response = transport.responseText || "no response text";
      textajax = overlib(response);
    },
    onFailure: function(){ alert('Something went wrong...') }
    });
 return textajax
}

function ht()
{
	return nd();
}

function productFCK()
{
	/*var oFCKeditor = new FCKeditor( 'content_min' ) ;*/
	var oFCKeditor = new FCKeditor( 'content_full' ) ;
}



function AjaxUU(id, value)
{
	$('przeliczanie').style.display="block";
	new Ajax.Request('/koszyk/zmienilosc/id/' + id + '/ilosc/' + value, {
        method: 'post',
        onSuccess:function(transport) {
		    var notice = $('przechow');
		    if (transport.responseText)
		      notice.update(transport.responseText);
		      $('totalPriceBasket').innerHTML = $('totalPrice').innerHTML;
		  }
        
    })
    
}


function AjaxU(id, value)
{
	setTimeout('AjaxUU('+id+','+value+')',1000);
	
}

/* Dotyczy danych do faktury oraz innych danych odbiorcy */
function see(id)
{
	if ($(id).checked == true)
	{
		$(id + 'Div').style.display = "block"
	}
	else
	{
		$(id + 'Div').style.display = "none"
	}
}

function repeatForm(param1,param2,param3)
{
	$(param2).value = $(param1).value
	$(param3).value = $(param1).value
}

function resetValue(id)
{
	$(id).selected = "selected"
}

function zmienAdres(id)
{
	new Ajax.Request('/koszyk/zmienadres/id/' + id, {
        method: 'post',
        onSuccess:function(transport) {
		    if (transport.responseText)
		    	var anserw = transport.responseText.split(",")
		        $('imieOther').value = anserw[0]
		        
		        $('adresOther').value = anserw[2]
		        $('nrdomuOther').value = anserw[3]
		        $('nrmieszkaniaOther').value = anserw[4]
		        $('kodOther').value = anserw[5]
		        $('miastoOther').value = anserw[6]
		        $('telefonOther').value = anserw[7]
		        
		        $('adresUsun').href = '/ksiegarnia/twojprofiladresusun/id/'+id
		  }
        
    })
}
