function hide_show_element(el_id){
	Effect.toggle(document.getElementById(el_id),'blind',{duration:0.5});
} 

function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		do {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		} while (obj = obj.offsetParent);
		return [curleft,curtop];
	}
}

function change_position(obj1, obj2){
	var position = findPos(obj1);
	obj2.style.left = (parseInt(position[0])+4)+'px';
	obj2.style.top = (parseInt(position[1])+4)+'px';
	obj2.style.display = '';
}


function selected_active_image(id_, max_, img_path){

	$('selecting_rank').onmouseout = function() {
		var w = 1;
		for(w ; w <= max_ ; w++){
		document.getElementById('star_'+w).style.backgroundImage = 'url('+img_path+'gray_star.png)'
		}
	}

	var i = 1;
	for(i ; i <= id_ ; i++){
		document.getElementById('star_'+i).style.backgroundImage = 'url('+img_path+'pink_star.png)';
	}
	for(i ; i <= max_ ; i++){
		document.getElementById('star_'+i).style.backgroundImage = 'url('+img_path+'gray_star.png)'
	}
}


	function add_new_upload_file(id){
		if(id < 10){
			$('file_'+id).removeAttribute('onchange');
	
			var container = document.getElementById('files_container');
			var next_id = parseInt((id+1));
			
			var tr_el = document.createElement('tr');
			tr_el.setAttribute('id', 'new_tr_'+next_id);
			container.appendChild(tr_el);
	
			var td_el_1 = document.createElement('td');
			td_el_1.setAttribute('id', 'new_td_1_'+next_id);
			td_el_1.setAttribute('class', 'file_counted_style');
			$('new_tr_'+next_id).appendChild(td_el_1);
			
			//nastepny numer pliku
			$('new_td_1_'+next_id).innerHTML=next_id+'.';
	
			var td_el_2 = document.createElement('td');
			td_el_2.setAttribute('id', 'new_td_2_'+next_id);
			td_el_2.setAttribute('class', 'color_pink');
			$('new_tr_'+next_id).appendChild(td_el_2);
	
			var new_created_td = $('new_td_2_'+next_id);
	
			var input_file = document.createElement('input');
			input_file.setAttribute('type', 'file');
			input_file.setAttribute('name', 'data[GalleryFile][]');
			input_file.setAttribute('id', 'file_'+next_id);
			input_file.setAttribute('onchange', 'add_new_upload_file('+next_id+')');
			new_created_td.appendChild(input_file);
		}

	}


	function search_by_type(search_type){
		
		$('SearchType').value = search_type;
		document.search_big_name_form.submit();
	}


	function validate_my_account_form(){
// 		var f_name_ = $('UserFirstName').value;
		var name_ = $('UserName').value;
//   		var provinve_  = $('UserProvinceId').value;
//              var usercity = $('UserCity').value;

		var returned = 0;

		//imie
// 		if(f_name_ == ''){
// 			$('UserFirstNameError').innerHTML="Imię jest wymagane.";
// 			returned = 1;
// 		}else{
// 			$('UserFirstNameError').innerHTML="";
// 		}

		//miasto
// 		if(usercity == ''){
// 			$('UserCityError').innerHTML="Miasto jest wymagane.";
// 			returned = 1;
// 		}else{
// 			$('UserCityError').innerHTML="";
// 		}

		//uzytkownik
		if(name_ == ''){
			$('UserNameError').innerHTML="Nazwa jest wymagana.";
			returned = 1;
		}else{
			$('UserNameError').innerHTML="";
		}

		//wojewodztwo
// 		if(provinve_ == ''){
// 			$('UserProvinceIdError').innerHTML="Województwo jest wymagane.";
// 			returned = 1;
// 		}else{
// 			$('UserProvinceIdError').innerHTML="";
// 		}


		if(returned == 1){
			alert('Proszę wypełnić wszystkie pola oznaczone gwiazdką');
			return false;
		}
	}
// galeria -- edycja

	function get_image_edit(id_){

		if(current_edited_photo == 0){	
				

			current_edited_photo = id_;
	
			var ed_img = document.getElementById('resized_'+id_);
			var styles = ed_img.style;
			styles.position = 'relative';
// // 			styles.paddingTop="10px;"
			styles.width="300px";
			styles.height="290px";
			styles.top = '3px';
			styles.left = '3px';
			styles.zIndex=101;
			styles.border="1px solid #D7046B";
			styles.backgroundColor='white';

			var pad_image = document.getElementById('pad_gale_thumb_'+id_);	
			pad_image.style.width="7%";

			var ed_img_right = document.getElementById('set_def_'+id_);
			var styles_right = ed_img_right.style;
			styles_right.display = 'block';
	
			var main_buttons = document.getElementById('desc_to_hide_'+id_);
			var styles_main_buttons = main_buttons.style;
			styles_main_buttons.display="none";
	
			var edit_ = document.getElementById('opt_'+id_);
			var edit_style = edit_.style;
			edit_style.display="block";

		}else{
			alert('Jestes w trakcie edycji innego zdjęcia.');
		}

	}	


	function cancel_save_img_info(id_){
		hide_gallery_edit_elements(id_);
		var textarea_id = document.getElementById(id_+'TmpDesc');
			textarea_id.value='';
		var ed_img = document.getElementById('resized_'+id_);
		ed_img.removeAttribute('style');
		var pad_image = document.getElementById('pad_gale_thumb_'+id_);	
		pad_image.style.width="22%";
	}	


	function hide_gallery_edit_elements(id_){
		current_edited_photo = 0;
		var ed_img = document.getElementById('resized_'+id_);
		var styles = ed_img.style;
// 			styles.paddingTop="0px;"
			styles.position = 'static';
			styles.width="130px";
			styles.height="130px";
			styles.top = '0px';
			styles.left = '0px';
			styles.zIndex=0;
			styles.border=0;
// 			styles.backgroundColor='transparent';

		var ed_img_right = document.getElementById('set_def_'+id_);
			var styles_right = ed_img_right.style;
			styles_right.display = 'none';
		var main_buttons = document.getElementById('desc_to_hide_'+id_);
			var styles_main_buttons = main_buttons.style;
			styles_main_buttons.display="block";
		var edit_ = document.getElementById('opt_'+id_);
			var edit_style = edit_.style;
			edit_style.display="none";
	}

	function save_image_info(id_){
		current_edited_photo = 0;
		var textarea_id = document.getElementById(id_+'TmpDesc');
		var hidden_value = document.getElementById(id_+'Description');
		hidden_value.value = textarea_id.value;
		var html_info = document.getElementById('gal_desc_'+id_);
		html_info.innerHTML = textarea_id.value;
		hide_gallery_edit_elements(id_);

		var pad_image = document.getElementById('pad_gale_thumb_'+id_);	
		pad_image.style.width="22%";

		SubmitForm('category_gallery_thumbs');
		return true;
	}

	function SubmitForm(someId){

		var url = url_photo_album_edit;

		var pars = escape(Sortable.serialize(someId));
		pars += '&'+Form.serializeElements(Form.getElements('photo_main'));
		var target = 'null_container';
		var myAjax = new Ajax.Updater(target, url, {method: 'post', parameters: {rates: pars}, asynchronous: false, onsucces: document.som_forms.submit()});
		return false;
	}

	function gallery_show_bigone(_src, view) {
		var _image = document.getElementById('gallery_big_photo_holder');
		_image.src = _src;
		document.getElementById('gallery_big_photo_holder_div').style.display = 'block';
		document.getElementById('gallery_big_photo_holder_div').style.top = view+'px';
	}

	function validate_form(){

		var input_name = $('UserUsername2');
		var input_username = $('UserName');

		var passw_1 = $('UserFirstPass');
		var passw_2 = $('UserPassword2');
		
		var pass = true;
		
		//name
		if(input_name.value == ''){
			$('username_mess').innerHTML="Musisz podać e-mail";
			pass = false;
		}else{
			$('username_mess').innerHTML="";
		}
		
		
		//password - rozne
		if(passw_1.value == passw_2.value){
			if( parseInt(passw_1.value.length) == 0){
				$('password_mess').innerHTML="Puste hasło";
				pass = false;
			}else{
				$('password_mess').innerHTML="";
			}
		}else{
			$('password_mess').innerHTML="Hasła są różne";
			pass = false;
		}
		
		//email-username
		reg = /^[a-zA-Z0-9\.ąćęłńóśżźĄĆĘŁŃÓŚŻŹ]{1,30}@[a-zA-Z0-9\.ąćęłńóśżźĄĆĘŁŃÓŚŻŹ]+(\.[a-zA-Z0-9ąćęłńóśżźĄĆĘŁŃÓŚŻŹ]+)+$/;
		wyn = input_name.value.match(reg);
		if (wyn == null) {
			$('username_mess').innerHTML = 'Nieprawidłowy e-mail';
		pass = false;
		}else{
			$('username_mess').innerHTML = '';
		}
		
		if(pass == true){
			return true;
		}else{
			return false;
		}
		
	}

	
//  GALERIE _ SHOW (photo_albums)
	function show_photo(id, controller){
		//podmiana lightboxa
		//$('lighbox_href').href=pictures_url+all_photos[id]+'_wm';
		$('lighbox_href').href=all_photos_wm[all_photos[id]];
		$('lighbox_href').title=all_photos_desc[id];

		var counted_desc = all_photos.length;
	
		var link_to_write = '';

		for (var i = 0; i < counted_desc; i++){
			if(i != id){
				//link_to_write=link_to_write+' '+'<a id="lighbox_href" rel="lightbox[showcases]" href="'+pictures_url+all_photos[i]+'" title="'+all_photos_desc[i]+'"></a>';
				link_to_write=link_to_write+' '+'<a id="lighbox_href" rel="lightbox[showcases]" href="'+all_photos_wm[all_photos[i]]+'" title="'+all_photos_desc[i]+'"></a>';
				//alert(all_photos_wm[all_photos[i]]);
			}
		}

		$('other_lightbox_links').innerHTML=link_to_write;


		var img_tmp = $('bigPhotoId');
		img_tmp.src = preLoad[id];
		
// 		var photo_id = all_photos[id];
		var text_photographer = all_photos_photographer[id];
		var text_desc = all_photos_desc[id];

// 		new Ajax.Updater('photo_id', url_show_photo+photo_id, {
// 				onSuccess: function() {
// 					document.getElementById('photo_id').style.display = '';
// 					document.getElementById('photo_id_loading').style.display = 'none';
// 				},
// 				onLoading: function() {
// 					document.getElementById('photo_id').style.display = 'none';
// 					document.getElementById('photo_id_loading').style.display = '';
// 				},
// 				onFailure :function() {
// 					document.getElementById('photo_id').style.display = '';
// 					document.getElementById('photo_id_loading').style.display = 'none';
// 				}
// 			});
		current_photo = id;
		
		if (current_photo == 0){
			document.getElementById('prev_photo').style.display = 'none';
			document.getElementById('no_prev_photo').style.display = '';
		}else{
			document.getElementById('prev_photo').style.display = '';
			document.getElementById('no_prev_photo').style.display = 'none';
		}
		
		if (current_photo == all_photos.length - 1){
			document.getElementById('next_photo').style.display = 'none';
			document.getElementById('no_next_photo').style.display = '';
		}else{
			document.getElementById('next_photo').style.display = '';
			document.getElementById('no_next_photo').style.display = 'none';
		}



		if (text_photographer != ''){
			$('photographer_name_container_td').style.display = '';
			$('photographer_name_container').innerHTML = text_photographer;	
		}else{
			$('photographer_name_container_td').style.display = 'none';
		}
			$('description_photo_container').innerHTML = text_desc;

		check_note_and_comments(all_photos[current_photo], controller);
	}
	
	function next_photo(controller){
		if (all_photos.length -1 > current_photo){
			show_photo(current_photo + 1, controller);
			
			if (current_photo > last_photo_gallery){
				next_photo_gallery();
			}
		}
	}
	
	function prev_photo(controller){
		if (current_photo > 0){
			show_photo(current_photo -1, controller);
			
			if (current_photo < first_photo_gallery){
				prev_photo_gallery();
			}
		}
	}
	
	function next_photo_gallery(){
		if (all_photos.length - 1 > last_photo_gallery){
			document.getElementById('image_'+first_photo_gallery).style.display = 'none';
			document.getElementById('image_'+(last_photo_gallery+1)).style.display = '';
			document.getElementById('ph_gal_div_'+first_photo_gallery).style.display = 'none';
			document.getElementById('ph_gal_div_'+(last_photo_gallery+1)).style.display = 'block';
			first_photo_gallery++;
			last_photo_gallery++;
			
			check_gallery();
		}
	}
	
	function prev_photo_gallery(){
		if (first_photo_gallery > 0){
			document.getElementById('image_'+(first_photo_gallery-1)).style.display = '';
			document.getElementById('image_'+last_photo_gallery).style.display = 'none';

			document.getElementById('ph_gal_div_'+(first_photo_gallery-1)).style.display = 'block';
			document.getElementById('ph_gal_div_'+last_photo_gallery).style.display = 'none';


			first_photo_gallery--;
			last_photo_gallery--;
			
			check_gallery();
		}
	}
	function check_note_and_comments(photo_id, controller){
	
		var inputs = document.getElementsByName('data[0]['+controller.toLowerCase()+'_id]');
		
		for (var i = 0; i < inputs.length; i++){
			inputs[i].value = photo_id;
		}
		
// 		if ($('0'+controller+'Id')){
// 			$('0'+controller+'Id').value = photo_id;
// 		}
		update_note_and_comments_info();
	}
	
	function check_gallery(){
		if (first_photo_gallery == 0){
			document.getElementById('prev_gallery').style.display = 'none';
		}else{
			document.getElementById('prev_gallery').style.display = '';
		}
		
		if (last_photo_gallery == all_photos.length - 1){
			document.getElementById('next_gallery').style.display = 'none';
		}else{
			document.getElementById('next_gallery').style.display = '';
		}
	}

	function update_note_and_comments_info(){
		new Ajax.Updater('note_info',url_update_note_note_info , {method: 'post', parameters: Form.serializeElements(Form.getElements('add_note_form'))});
		new Ajax.Updater('comment_info',url_update_note_comment_info , {method: 'post', parameters: Form.serializeElements(Form.getElements('add_comment_form'))});
	}
	
// END GALERIA _ SHOW


// photo_albums/add_gallery

	function ajax_addItemToList1(){
		if(prev_inserted[1] != false) {
			//deleteItemImIn(prev_inserted, 'SPAN');
			//prev_inserted = false;
		}
		addItemToList(1);
	}
	
	function ajax_addItemToList2(){
		if(prev_inserted[2] != false) {
			//deleteItemImIn(prev_inserted, 'SPAN');
			//prev_inserted = false;
		}
		addItemToList(2);
	}

	function addItemToList(number) {

		invitation_count[number] ++;
		var container = $('tags_list_'+number);
		var val = $('autocomplete_'+number).value;
		var tag = val.replace('>', '').split('<');

// 		alert(email[0]+';'+email[1]);
// 		alert(email[1]);

		if( !(tag[1]) ) {
			tag = tag[0];
		}else{
			tag = tag[1]+' '+tag[0];
		}

 		//alert(tag);
// 		var name = val.slice( 0, val.index );


		var new_item = document.createElement('span');
// 		new_item.innerHTML = "<a title='click to delete' onclick=\"deleteItemImIn(this, 'SPAN'); invitation_count--;\">"+val.replace('<', '&lt;').replace('>', '&gt;')+"<input style='display:none' type='hidden' value='"+tag+"' name='data[Invitations][]'></input></a>, ";

		new_item.innerHTML = "<a title='click to delete' onclick=\"deleteItemImIn(this, 'SPAN'); invitation_count[number]--;\">"+tag+"<input style='display:none' type='hidden' value='"+tag+"' name='data[Tags][]'></input></a>, ";
		
		container.appendChild(new_item);

		prev_inserted[number] = new_item;

		clearItemValue('autocomplete_'+number);
		return false;
	}

	function clearItemValue(itemId) {
		var item = $(itemId);
		item.value ='';
		item.focus();
	}

	function checkCount(form_) {
		if(invitation_count<1) {
			alert('Email');
			return false;
		}else{
			//form_.submit();
			return true;
		}
	}






//end photo_albums/add_gallery



//KATALOG PRODUKTÓW

//odnalezienie wszystkich produktów należących do kategorii zaznaczonego produktu 
function find_products(product_id){

	var product_category_id = product_categories[product_id];
	
	var products_length = products.length;
	
	for (i = 0; i < products_length; i++){
		
		var current_product = products[i];
		
		if (product_categories[current_product] != product_category_id){
			$('product_'+current_product).disabled = true;
		}
	}
	
	check_products();
	
	//gdy odznaczył wszystko
	
	if (products_id.length == 2){
		for (i = 0; i < products_length; i++){
			$('product_'+products[i]).disabled = false;
		}
	}
}


//otworzenie porównywarki
function compare_products(){

	check_products();

	if (products_id == '/'+category_id){
		alert ('Wybierz produkty!');
	}else{
		document.location.href = product_compare_link+products_id;
	}
}


//sprawdza jakie produkty są zaznaczone
function check_products(){

	products_id = '/'+category_id;

	var products_length = products.length;

	for (i = 0; i < products_length; i++){
		if ($('product_'+products[i]).checked){
			products_id += '/'+products[i];
		}
	}
}
function hide_show_element_order(el_id){
	Effect.toggle(document.getElementById(el_id),'blind',{duration:0.5});

} 
function searchOrder(id) {
	document.getElementById("orderDiv").value=id;
	document.search_big_name_form.submit();
}

//Openx

//todo -> bedzie trzeba podmienic adres po przeniesieniu systemu na serwer

function OA_adjs(z,n,c,div_id, div2_id)
{
	if (z>-1) {

		var az = OA_p+"//concept.netarch.eu/openx/www/delivery/ajs.php?n="+n+"&zoneid="+z;
		az+="&source="+OA_channel+"&exclude="+document.OA_used+"&r="+OA_r;
		az+="&mmm_fo="+(document.mmm_fo)?'1':'0';
		az+="&tag="+OA_tag;
		
		if (c != null) az+= "&count="+c;
		if (document.context) az+= "&context=" + escape(document.context);
		if (window.location) az+="&loc="+escape(window.location);
		if (document.referrer) az+="&referer="+escape(document.referrer);
				
		new Ajax.Updater($(div_id), az, {
			onComplete:function()
			{
				if ($(div_id).innerHTML != ''){
					hide_show_element(div2_id);
				}
			}
			}
		);
	}
}

//zmiana województwa w wyszukiwaniu w katalogu produktów
function change_province(id, province_name){
	$('SearchProvinceId').value = id;
	$('province_name').innerHTML = province_name;
	$('sort_provinces').style.display = 'none';

}

function insert_values_search(){

	var perscount = eval(document.getElementById("ArticlePhrase"));	
	var defperscount = "szukaj";
	if(perscount.value == ''){
		perscount.value = defperscount;
	}

}

function clear_value(id, phrase){

	var input_element = eval(document.getElementById(id));

	if( input_element.value == phrase ){
		input_element.value = '';
	}
}

//dodanie komentarza
function add_comment(url_comments_add){
	var content = $('CommentContent').value;
	
	if (content != ''){
		var updater = new Ajax.Request(url_comments_add, {method: 'post',
			parameters: Form.serializeElements( Form.getElements('add_comment_form') ),
			onSuccess: function() {
				$('request').innerHTML = 'Dziękujemy za dodanie komentarza.';
				$('add_comment_div').style.display = '';
				$('add_comment_sending').style.display = 'none';
				$('CommentContent').value = '';
				//location.reload(true);
				new Ajax.Updater('comment_info',url_update_note_comment_info , {method: 'post', parameters: Form.serializeElements(Form.getElements('add_comment_form')), onComplete:function(){hide_show_element('request');}});
			},
			onLoading: function() {
				$('request').innerHTML = '';
				$('add_comment_div').style.display = 'none';
				$('add_comment_sending').style.display = '';
			},
			onFailure :function() {
				$('request').innerHTML = 'Wystąpił błąd. Komentarz nie został dodany.';
				$('add_comment_div').style.display = '';
				$('add_comment_sending').style.display = 'none';
			}
		});
	}else{
		alert ('Wpisz komentarz!');
	}
}

//dodanie oceny
function add_note(note_, url_notes_add){
	var note_for_article = document.getElementById('NoteNote');
	note_for_article.value = note_;
	new Ajax.Updater('note_info', url_notes_add, {method: 'post', parameters: Form.serializeElements(Form.getElements('add_note_form'))});
}

function change_product_info(product_info){

	if ($(product_info).style.display == 'none'){
		if (product_info == 'product_details'){
			$('product_outlets').style.display = 'none';
			$('product_details').style.display = '';
			$('product_details_info').className = 'product_more_info_title_show';
			$('product_outlets_info').className = 'product_more_info_title_hide';
		}else if (product_info == 'product_outlets'){
			$('product_details').style.display = 'none';
			$('product_outlets').style.display = '';
			$('product_outlets_info').className = 'product_more_info_title_show';
			$('product_details_info').className = 'product_more_info_title_hide';
		}
	}
}

function change_entry_info(product_info){


	if (product_info == 'all_products_info'){

		$('all_product_outlets_info').style.display = 'none';
		$('all_contact_form_info').style.display = 'none';
		$('all_products_info').style.display = 'block';
	
		$('all_products_but').className = 'product_more_info_title_show';
		$('all_product_outlets_but').className = 'product_more_info_title_hide';
		$('all_contact_form_but').className = 'product_more_info_title_hide';

	}else if(product_info == 'all_product_outlets_info'){

		$('all_products_info').style.display = 'none';
		$('all_product_outlets_info').style.display = 'block';
		$('all_contact_form_info').style.display = 'none';
	
		$('all_products_but').className = 'product_more_info_title_hide';
		$('all_product_outlets_but').className = 'product_more_info_title_show';
		$('all_contact_form_but').className = 'product_more_info_title_hide';

	}else if(product_info == 'all_contact_form_info'){

		$('all_products_info').style.display = 'none';
		$('all_product_outlets_info').style.display = 'none';
		$('all_contact_form_info').style.display = 'block';
	
		$('all_products_but').className = 'product_more_info_title_hide';
		$('all_product_outlets_but').className = 'product_more_info_title_hide';
		$('all_contact_form_but').className = 'product_more_info_title_show';
	}
}

function change_photo(id){
// 	new Ajax.Updater('product_photo', url_product_photos_product_photo_ajax+photo_id, {
// 			onComplete: function() {
// 				document.getElementById('product_photo').style.display = '';
// 				document.getElementById('product_photo_loading').style.display = 'none';
// 			},
// 			onLoading: function() {
// 				document.getElementById('product_photo').style.display = 'none';
// 				document.getElementById('product_photo_loading').style.display = '';
// 			},
// 			onFailure :function() {
// 				document.getElementById('product_photo').style.display = '';
// 				document.getElementById('product_photo_loading').style.display = 'none';
// 			}
// 		});
	$('product_photo_img').src = preLoad[id];

	$('videos_container').innerHTML = '';
	
// 	$('lighbox_href').href=pictures_url+all_photos[id];

	//podmiana lightboxa
	$('lighbox_href').href=pictures_url+all_photos[id];
// 	$('lighbox_href').title=all_photos_desc[id];

	var counted_desc = all_photos.length;

	var link_to_write = '';

	for (var i = 0; i < counted_desc; i++){
		if(i != id){
			link_to_write=link_to_write+' '+'<a id="lighbox_href" rel="lightbox[showcases]" href="'+pictures_url+all_photos[i]+'" title=""></a>';
		}
	}

	$('other_lightbox_links').innerHTML=link_to_write;


}

function del_photo_from_gallery(id){
	document.getElementById('photo_'+id).innerHTML='';
	document.getElementById('photo_'+id).style.display='none';

}

function submit_product_form(product_url){
	$('product_sort_form').action = main_url + product_url;
	$('product_sort_form').submit();
}

function submit_product_form2(product_url){
	$('product_sort_form').action = product_url;
	$('product_sort_form').submit();
}

function submit_product_search(){
	if ($('product_sort_form')){
		$('SearchProductName').value = $('SearchName').value;
		$('product_sort_form').submit();
		return false;
	}
	
	return true;
}

function submit_form_search_product(url){
	if ($('product_sort_form')){
		$('product_sort_form').action = url;
		$('product_sort_form').submit();
		return false;
	}
	
	return true;
}

function change_arrow(id, color){
	if ($('arrow_'+id)){
		$('arrow_'+id).src = img_layout_url+'right-'+color+'-trans.png';
	}
}

function clear_inputs(){

	var ask = confirm('Wyszyścić wszystkie pola?');
	if(ask == true){
		var inputs = document.getElementsByTagName('input');
		var i = 0;
		for(i ; i < inputs.length ; i++){
			if(inputs[i].getAttribute('type') == 'text') {	
				inputs[i].value = '';
			}
			if(inputs[i].getAttribute('class') == 'long_file_div') {	
				inputs[i].value = '';
			}
		}
		$('PhotoAlbumDescription').value='';
	}
}

	function show_additional_info(div_info, id){

// 		$(id).style.display = 'block';
		hide_show_element(id);
		var position = findPos(div_info);
		$(id).style.left = (position[0]+ div_info.offsetWidth+5)+'px';
		$(id).style.top = (position[1])+'px';
		
	}
function show_product_more_info(){
	$('product_details').style.display = 'block';
	$('product_show_more_info').style.display = 'none';
	
}

function show_hide_new_product(){
	if ($('sortable_table')){
		if ($('sortable_table').style.display == 'none'){
			$('sortable_table').style.display = 'block';
		}else if ($('sortable_table').style.display == 'block' || $('sortable_table').style.display == ''){
			$('sortable_table').style.display = 'none';
		}
	}
	if ($('new_product_hide')){
		if ($('new_product_hide').style.display == 'none'){
			$('new_product_hide').style.display = 'block';
		}else if ($('new_product_hide').style.display == 'block' || $('new_product_hide').style.display == ''){
			$('new_product_hide').style.display = 'none';
		}
	}
}

function mod_comment(model, id){
	if (confirm('Czy napewno chcesz zgłosić ten komentarz?')){
		new Ajax.Request(url_mod_comments, {method: 'post', parameters: {model: model, id: id}, onSuccess:function(){alert('Dziękujemy za zgłoszenie');}});
	}
}


function insert_search_values(){

	var article_phrase = document.getElementById('ArticlePhrase');
	if(article_phrase.value == search_inside_input){
		article_phrase.value='';
	}else if(article_phrase.value == ''){
		article_phrase.value=search_inside_input;
	}
}

function display_new_video(url, id){
	var video_container = document.getElementById('videos_container');
	
	$('product_photo_img').src = url+'img/layout/empty.gif';
	
	video_container.innerHTML = '<img src="'+url+'img/ajax.gif'+'" />';
	
	new Ajax.Updater(video_container, url+'videos/disp/'+id, {asynchronous:true, evalScripts: true});
	
//	product_photo_img
	
}