function change_input_text(id, text) {
	if ($("#"+id).val() == text) {
		$("#"+id).attr("value", "");
	} else if ($("#"+id).val() == ''){
		$("#"+id).attr("value", text);
	}
}

function change_vkl(div, id) {
	div_div = $("DIV", $("#"+div));
	for (i=0;i<div_div.length;i++) {
		$(div_div[i]).attr("class") == 'vkl_activ' ? $(div_div[i]).attr("class", "vkl") : '';
		$("#"+$(div_div[i]).attr("id")+"_text").css("display", "none");
	}
	$("#"+id).attr("class", "vkl_activ");
	$("#"+id+"_text").css("display", "block");
}

function show_detal_photo(id) {
	if ($("#"+id).css("display") == "block") {
		$("#"+id).hide();
	} else {
		$("#"+id).show();
	}
}

var c_pos=0;

function c_prev(id, id2) {
	c_pos==0 ? c_set((c_pos=(get_total_photo(id)-1)),0) : '';
    c_set(--c_pos,200,id,id2);
}

function c_next(id, id2) { 
	c_pos==(get_total_photo(id)-1) ? c_set((c_pos=0),0) : '';
		c_set(++c_pos, 200, id, id2);
}

function c_set(pos, delay, id, id2) {
	$('#'+id).animate({marginLeft:-pos*parseInt($("#"+id2).css("width"))}, delay );      
}  

function get_total_photo(id) {
	return $("DIV", $("#"+id)).length - $("P", $("#"+id)).length;
}

function change_adres_shop(id) {
	var tclass = 'activ', div = 'div_cls_shop';
	if ($("#"+id).attr("class") != tclass) {
		div_id = $("SPAN", $("#"+div));
		for (i=0;i<div_id.length;i++) {
			$(div_id[i]).attr("class", "ss");
			$("#text_"+$(div_id[i]).attr("id")).hide();
		}
		$("#"+id).attr("class", tclass);
		$("#text_"+id).show();
	}
}

function display_photo_big(id, img) {
	if ($("#"+id).attr("class")!='activ' && $("#img_big_shop IMG").attr("width")!=16) {
		img_q = $("DIV", $("#list_photo_min"));
		for (i=0;i<img_q.length;i++) {
			$(img_q[i]).attr("class", "");
			
		}
		$("#"+id).attr("class", "activ");
		title = $("#"+id+" IMG").attr("alt");
		bigImage = new Image();
		bigImage.src = img;
		img_height = $("#img_big_shop IMG").attr("height");
		$("#img_big_shop P").html('');
		$("#img_big_shop IMG").attr("src", "./images/loading.gif");
		$("#img_big_shop").css("padding", ((img_height+8)/2)+"px");
		$("#img_big_shop").css("width", "auto")
		setTimeout('display_image("'+img+'", "'+title+'")', 0);
	}
}

function display_image(img, title) {
	if (bigImage.complete == true) {
		$("#img_big_shop").css("padding", "0px");
		$("#img_big_shop P").html(title);
		$("#img_big_shop IMG").attr("src", img);
	} else {
		setTimeout('display_image("'+img+'", "'+title+'")', 0);
	}
}
