function UpdateCursorPosition(e)
{
	cX = e.pageX;
	cY = e.pageY;
}
function UpdateCursorPositionDocAll(e)
{
	cX = event.clientX;
	cY = event.clientY;
}
if (document.all)
	document.onmousemove = UpdateCursorPositionDocAll;
else
	document.onmousemove = UpdateCursorPosition;
var cX = 0; var cY = 0; var rX = 0; var rY = 0;
function AssignPosition(d, first)
{
	if(document.documentElement && document.documentElement.scrollTop)
	{
		rX = document.documentElement.scrollLeft;
		rY = document.documentElement.scrollTop;
		wX = document.documentElement.clientWidth;
		wY = document.documentElement.clientHeight;
	}
	else if(document.body)
	{
		rX = document.body.scrollLeft;
		rY = document.body.scrollTop;
		if (document.body.clientWidth)
		{
			wX = document.body.clientWidth;
			wY = document.body.clientHeight;
		}
		else
		{
			wX = document.documentElement.clientWidth;
			wY = document.documentElement.clientHeight;
		}
	}
	else if(self.pageYOffset)
	{
		rX = self.pageXOffset;
		rY = self.pageYOffset;
		wX = self.innerwidth;
		wY = self.innerheight;
	}
	if(document.all)
	{
		cX += rX;
		cY += rY;
	}
	if (first)
		FitWindow(d, cX, cY, rX, rY, wX, wY);
	else
		FitWindow2(d, cX, cY, rX, rY, wX, wY);
}
function FitWindow(d, cX, cY, rX, rY, wX, wY)
{
	if ((cX + 10 + d.offsetWidth - rX) > wX)
	{
		if ((cX + d.offsetWidth - 10) > rX)
			the_left = (cX - d.offsetWidth - 10) + "px";
		else
			the_left = (cX + 10) + "px";
	}
	else
		the_left = (cX + 10) + "px";
	if ((cY - d.offsetHeight - 5) > rY)
		the_top = (cY - d.offsetHeight - 5) + "px";
	else if ((cY + 5 + d.offsetHeight) < wY + rY)
		the_top = (cY + 5) + "px";
	else
		//d.style.top = (cY - d.offsetHeight - 5) + "px";
		the_top = rY + "px";
	d.style.left = the_left;
	d.style.top = the_top;
}
function FitWindow2(d, cX, cY, rX, rY, wX, wY)
{
	var the_div = document.getElementById("big_img_zoom");
	the_div.style.display = "block";
	var the_img = the_div.getElementsByTagName("img")[0];
	var the_pos = findPos(the_div);
	var mouse_x = the_pos[0];
	var mouse_y = the_pos[1];
	var the_top = parseInt((cY - mouse_y) / the_div.clientHeight * (the_img.clientHeight - the_div.clientHeight));
	var the_left = parseInt((cX - mouse_x) / the_div.clientWidth * (the_img.clientWidth - the_div.clientWidth));
	//document.getElementById("test_js").innerHTML = cX + " | " + cY + " | " + rX + " | " + rY + " | " + wX + " | " + wY + " | " + the_top + " | " + the_left + " | " + mouse_x + " | " + mouse_y + " | ";
	try
	{
		the_img.style.top = -the_top;
		the_img.style.left = -the_left;
	}
	catch (e)
	{
	}
}
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 hide_tooltip(d)
{
	if(d.length < 1)
		return;
	document.getElementById(d).style.display = "none";
}
function show_tooltip(d)
{
	if(d.length < 1)
		return;
	var dd = document.getElementById(d);
	AssignPosition(dd, true);
	dd.style.display = "block";
}
function hide_zoom_img()
{
	document.getElementById("big_img_zoom").style.display = "none";
}
var the_width = 0;
function zoom_img()
{
	var the_img = document.getElementById("big_img_zoom").getElementsByTagName("img")[0];
	if ((the_img.src.indexOf("i/b.gif") < 0) && (the_width > 440))
	{
		AssignPosition(document.getElementById("big_img_zoom"), false);
		document.getElementById("big_img_zoom").style.display = "block";
	}
}
function show_spune_parere()
{
	document.getElementById("parerea_ta").style.display = "block";
}
function sel_pr(pr_id, pref){
	var pr_in = document.getElementById(pref + "in_" + pr_id);
	if (pr_in != null)
		if (pr_in.value == "false")
		{
			pr_in.value = "true";
			//document.getElementById(pref + "div_" + pr_id).style.border = "2px solid green";
			document.getElementById(pref + pref + "_" + pr_id).src = "img/checkboxchecked.gif";
			eval ("x" + pref + "++;");
		}
		else
		{
			pr_in.value = "false";
			//document.getElementById(pref + "div_" + pr_id).style.border = "2px solid white";
			document.getElementById(pref + pref + "_" + pr_id).src = "img/checkbox.gif";
			eval ("x" + pref + "--;");
		}
}
function old_sel_pr(pr_id, pref){
	var pr_in = document.getElementById(pref + "in_" + pr_id);
	if (pr_in != null)
		if (pr_in.value == "false")
		{
			pr_in.value = "true";
			//document.getElementById(pref + "div_" + pr_id).style.border = "2px solid green";
			document.getElementById(pref + pref + "_" + pr_id).src = "img/checkboxchecked.gif";
		}
		else
		{
			pr_in.value = "false";
			//document.getElementById(pref + "div_" + pr_id).style.border = "2px solid white";
			document.getElementById(pref + pref + "_" + pr_id).src = "img/checkbox.gif";
		}
}
function change_cul(el_id, cul, sex, t_id){
	if (el_id != "do_not_change")
	{
		var el = document.getElementById(el_id);
		if (el != null)
		{
			var hr = el.href;
			var hr_in = hr.indexOf("_culoare-");
			if (hr_in > -1)
				//el.href = hr.substr(0, hr_in + 9) + cul + hr.substr(hr_in + 10);
				el.href = hr.replace(/_culoare-[0-9]+/g, "_culoare-" + cul)
			else
				el.href += "_culoare-" + cul;
		}
		el = document.getElementById(el_id + "_href");
		if (el != null)
		{
			var hr = el.href;
			var hr_in = hr.indexOf("_culoare-");
			if (hr_in > -1)
				//el.href = hr.substr(0, hr_in + 9) + cul + hr.substr(hr_in + 10);
				el.href = hr.replace(/_culoare-[0-9]+/g, "_culoare-" + cul)
			else
				el.href += "_culoare-" + cul;
		}
		// we have to modify this function to get it from a cache made with php
		get_tshirt_price(t_id, sex, "all", cul, "price_" + el_id);
	}
}
function change_comanda_price(cul, sex, marime, t_id){
	get_tshirt_price(t_id, sex, marime, cul, "price_big");
	var tmp_href_b=location.protocol+'//'+location.host+location.pathname+location.search;
//	var tmp_href_b = document.location.href.substr(0, document.location.href.indexOf("#"));
	var tmp_href_a = "";
	if (cul != "all")
		tmp_href_a += "_culoare-" + cul;
	if (sex != "all")
		tmp_href_a += "_sex-" + sex;
	if (marime != "all")
	{
		tmp_href_a += "_marime-" + marime;
		if (cul != "all")
			get_potriviri(sex, marime);
		else
			document.getElementById("potriviri").innerHTML = '<!-- -->';
	}
	else
		document.getElementById("potriviri").innerHTML = '<!-- -->';
	if (tmp_href_a.length > 0)
		tmp_href_af = tmp_href_a.substr(1);
	the_loc = tmp_href_b + "#" + tmp_href_af;
	if(navigator.appVersion.search(/MSIE 6.0/)==-1)
		document.location.href = the_loc;
	var the_ym_link = document.getElementById("send_ym");
	var the_tf_link = document.getElementById("send_tf");
	var to_change = the_ym_link.href.match(/\+http[^\+]*\+/i);
	the_ym_link.href = the_ym_link.href.replace(to_change, "+" + the_loc + "+");
}
function get_tshirt_price(id, sex, marime, culoare, el)
{
	var x, y, z, pars;
	if ((typeof (x = tshirts_prices[id]) != "undefined") && (typeof (y = x[sex]) != "undefined") && (typeof (z = y[marime]) != "undefined") && (typeof (pars = z[culoare]) != "undefined"))
	{
		pars = pars.split("|");
		var the_el = document.getElementById(el);
		var the_el_disc = document.getElementById(el + "_discount");
		if (the_el)
			the_el.innerHTML = pars[0];
		if (the_el_disc)
		{
			the_el_disc.getElementsByTagName("strong")[0].innerHTML = pars[1];
			try
			{
				if (parseInt(pars[1]) > parseInt(pars[0]))
				{
					the_el_disc.style.display = "block";
				}
				else
				{
					the_el_disc.style.display = "none";
				}
			}
			catch (e)
			{
			}
		}
	}
	else
		get_ajax_tshirt_price(id, sex, marime, culoare, el);
}
function get_ajax_tshirt_price(id, sex, marime, culoare, el)
{
	var xmlHttp = GetXmlHttpObject();
	if (xmlHttp == null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	}
	xmlHttp.onreadystatechange = function()
	{
		if(xmlHttp.readyState == 4)
		{
			var pars = xmlHttp.responseText.split("|");
			var the_el = document.getElementById(el);
			var the_el_disc = document.getElementById(el + "_discount");
			if (the_el)
				the_el.innerHTML = pars[0];
			if (the_el_disc)
			{
				the_el_disc.getElementsByTagName("strong")[0].innerHTML = pars[1];
				try
				{
					if (parseInt(pars[1]) > parseInt(pars[0]))
					{
						the_el_disc.style.display = "block";
					}
					else
					{
						the_el_disc.style.display = "none";
					}
				}
				catch (e)
				{
				}
			}
		}
	}
	var params = 'id=' + id + '&sex=' + sex + '&culoare=' + culoare + '&marime=' + marime;
	xmlHttp.open ("GET", "__get_thist_price.php?" + params, true);
	xmlHttp.send (null);
}

function get_potriviri(sex, marime, fara_div)
{
	var xmlHttp = GetXmlHttpObject();
	if (xmlHttp == null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	}
	xmlHttp.onreadystatechange = function()
	{
		if(xmlHttp.readyState == 4)
		{
			document.getElementById('potriviri').innerHTML = xmlHttp.responseText;
		}
	}
	var params = 'sex=' + sex + '&marime=' + marime + ((fara_div) ? "&fara_div=true" : "");
	xmlHttp.open ("GET", "_get_potriviri.php?" + params, true);
	xmlHttp.send (null);
}
function ucfirst( str ) {
    // http://kevin.vanzonneveld.net
    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   bugfixed by: Onno Marsman
    // +   improved by: Brett Zamir
    // *     example 1: ucfirst('kevin van zonneveld');
    // *     returns 1: 'Kevin van zonneveld'
    str += '';
    var f = str.charAt(0).toUpperCase();
    return f + str.substr(1);
}
// ruxandra_turo
function get_ym_status(id)
{
	var xmlHttp = GetXmlHttpObject();
	if (xmlHttp == null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	}
	xmlHttp.onreadystatechange = function()
	{
		if(xmlHttp.readyState == 4)
		{
			document.getElementById("ym_status_02").className = "send_msg_pop_" + xmlHttp.responseText;
			document.getElementById("ym_status_img_01").src = "img/y_" + xmlHttp.responseText + ".gif";
			document.getElementById("ym_status_span_01").innerHTML = "(" + ucfirst(xmlHttp.responseText) + ")";
		}
	}
	xmlHttp.open ("GET", "__get_ym_status.php?id=" + id, true);
	xmlHttp.send (null);
}
function $(id){
	return document.getElementById(id);
}
function show_calendar(box){
	var leftPos = (screen.availWidth-200) / 2
	var topPos = (screen.availHeight-280) / 2
	showCalWin = window.open(base_href+'date_popup.php?text='+box,'','width=200,height=280,scrollbars=no,resizable=no,titlebar=0,top=' + topPos + ',left=' + leftPos);
}
function arata_tricou(id, sex) {
	window.location=unde+"#top";
	document.index_tu.SetVariable("_level0.tricou", id);
	document.index_tu.SetVariable("_level0.sex_site", sex);
	document.index_tu.SetVariable("_level0.dinpromo", 0);
	document.index_tu.GotoFrame(0);
	document.index_tu.Play();
}
function p(adresa) {
	windowW=780;
	windowH=500;
	windowX = screen.width/2-windowW/2;
	windowY = screen.height/2-windowH/2;
        var EB = window.open(base_href+'zoom.html?pic='+adresa,"lp","width="+windowW+", height="+windowH+", fullscreen=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=0", true)
	EB.resizeTo(windowW, windowH);
	EB.moveTo(windowX,windowY)
	EB.focus()
}
function pop_up(adresa, windowW, windowH, scrollbar){
	windowX = screen.width/2-windowW/2;
	windowY = screen.height/2-windowH/2;
        var EB = window.open(base_href+adresa,"lp", "width="+windowW+", height="+windowH+", fullscreen=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=" + ((scrollbar) ? "yes" : "no") + ",resizable=0", true)
	EB.resizeTo(windowW, windowH);
	EB.moveTo(windowX,windowY)
	EB.focus()
}
function run_flash2(source, width, height, el_id)
{
	var div = document.getElementById('hide_'+el_id);
	if (div)
		div.style.display = 'none';
	if (AC_FL_RunContent == 0) {
		alert("This page requires AC_RunActiveContent.js.");
	} else {
		AC_FL_RunContent(
			"codebase", "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0",
			"width", width,
			"height", height,
			"src", source,
			"quality", "best",
			"pluginspage", "http://www.macromedia.com/go/getflashplayer",
			"align", "middle",
			"play", "true",
			"loop", "true",
			"scale", "noscale",
			"wmode", "transparent",
			"devicefont", "false",
			"id", el_id,
			"bgcolor", "#ffffff",
			"name", "thumbnail",
			"menu", "true",
			"allowFullScreen", "false",
			"allowScriptAccess","sameDomain",
			"movie", source,
			"salign", "lt"
			); //end AC cod
	}
}
function GetXmlHttpObject(){
	var xmlHttp = null;
	try{
		xmlHttp=new XMLHttpRequest();
	}
	catch (e){
		try{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e){
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}
function make_ajax_submit(el_id, fl_params){
	var xmlHttp = GetXmlHttpObject();
	if (xmlHttp == null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	}
	xmlHttp.onreadystatechange = function()
	{
		if(xmlHttp.readyState == 4)
		{
			var pars = xmlHttp.responseText.split("|");
			run_flash(pars[0], pars[1], pars[2], "aj_t_shirt");
			sel_t_shirt = pars[3];
			sel_cul = pars[4];
		}
	}
	var params = 'nume='+fl_params[0]+'&culoarea='+fl_params[1];
	xmlHttp.open ("GET", "__get_new_flash.php?" + params, true);
	xmlHttp.send (null);
}
function ajax_get_prods(id, filters) {
	var xmlHttp = GetXmlHttpObject();
	if (xmlHttp == null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	}
	xmlHttp.onreadystatechange = function()
	{
		if(xmlHttp.readyState == 4)
		{
			document.getElementById(id).innerHTML = xmlHttp.responseText;
		}
	}
	xmlHttp.open ("GET", "__get_number_of_prods.php?" + filters, true);
	xmlHttp.send (null);
}
function ajax_scroll_img(direction, total, container_id, big_container_id, model_id) {
	start = document.getElementById(container_id).getElementsByTagName('div')[0].id;
	var img_right = 'url("img/arrow_right.gif")';
	var img_right_inactive = 'url("img/arrow_right_inactive.gif")';
	var img_left = 'url(img/arrow_left.gif)';
	var img_left_inactive = 'url(img/arrow_left_inactive.gif)';
	if (((direction == "left") && (start == "0")) || ((direction == "right") && ((start + 6) >= total)))
		return ;
	var xmlHttp = GetXmlHttpObject();
	if (xmlHttp == null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	}
	xmlHttp.onreadystatechange = function()
	{
		if(xmlHttp.readyState == 4)
		{
			var the_res = xmlHttp.responseText.split("#|#");
			document.getElementById(container_id).innerHTML = the_res[0];
			document.getElementById(big_container_id).getElementsByTagName('td')[0].innerHTML = the_res[1];
		}
		if (direction == "left")
		{
			start--;
			if (start == 0)
				document.getElementById('arrow_left').style.backgroundImage = img_left_inactive;
			document.getElementById('arrow_right').style.backgroundImage = img_right;
		}
		else
		{
			start++;
			if (start + 5 == total)
				document.getElementById('arrow_right').style.backgroundImage = img_right_inactive;
			document.getElementById('arrow_left').style.backgroundImage = img_left;
		}
	}
	xmlHttp.open ("GET", "__scroll_shirt_images.php?start=" + ((direction == "left") ? start - 1 : start + 1) + "&direction=" + direction + "&model=" + model_id, true);
	xmlHttp.send (null);
}
var response;
function ajax_settings_submit(div, value){
	var xmlHttp = GetXmlHttpObject();
	if (xmlHttp == null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	}
	xmlHttp.onreadystatechange = function()
	{
		if(xmlHttp.readyState == 4)
		{
			return;
		}
	}
	var params = 'nume='+div+'&value='+value;
	xmlHttp.open ("GET", "collapse_settings.php?" + params, true);
	xmlHttp.send (null);
}
function ajax_settings_get(div, value){
	var xmlHttp = GetXmlHttpObject();
	if (xmlHttp == null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	}
	xmlHttp.onreadystatechange = function()
	{
		if(xmlHttp.readyState == 4)
		{
			var pars = xmlHttp.responseText.split("=");
			setView(pars[0],pars[1]);
		}
	}
	var params = 'nume='+div;
	xmlHttp.open ("GET", "collapse_settings.php?" + params, true);
	xmlHttp.send (null);
}
function setView(id, value){
	if (value==0)
	{
		if (id == 'filters'){
			hideDiv('filters');
		}
		if (id == 'parerea_ta'){
			hideDiv('parerea_ta');
		}
	}
}
function setupCollapsables()
{
	var divs = new Array('filters', 'parerea_ta');
	for (var i=0; i<divs.length; i++ ){
		ajax_settings_get(divs[i], '');
	}
}
function urlencode( str ) {
    // http://kevin.vanzonneveld.net
    // +   original by: Philip Peterson
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // *     example 1: urlencode('Kevin van Zonneveld!');
    // *     returns 1: 'Kevin+van+Zonneveld%21'
    var ret = str;
    ret = ret.toString();
    ret = encodeURIComponent(ret);
    ret = ret.replace(/%20/g, '+');
    return ret;
}
/*
Array.prototype.inArray = function (value) {
	var i;
	for (i=0; i < this.length; i++) {
		if (this[i] === value){
			return i;
		}
	}
	return null;
};
*/
function postalCodeLink(a, oras, judet, p1, p2){
	//http://www.coduripostale.com/cgi-bin/coduri_postale.cgi?mod=cs&jud=BH&loc=Adoni
	var i = p1.inArray(judet.toLowerCase());
	if (i != null)
	{
		a.href = 'http://www.coduripostale.com/cgi-bin/coduri_postale.cgi?mod=cs&jud='+p2[i]+'&loc='+oras;
	}
	else
	{
		i = p2.inArray(judet.toUpperCase());
		if (i != null)
		{
			//alert("here");
			a.href = 'http://www.coduripostale.com/cgi-bin/coduri_postale.cgi?mod=cs&jud='+p2[i]+'&loc='+oras;
		}
		else
		{
			a.href = 'http://www.coduripostale.com/cgi-bin/coduri_postale.cgi?mod=cs&loc='+oras;
		}
	}
}
function set_send_url(id, tu){
	var a = document.getElementById(id);
	var tuuri = document.getElementById(tu).value;
	if (tuuri < 0)
	{
		alert('Nu poti comanda mai multe premii decat iti permit tuurile tale!')
		a.href = 'useri/cos.html';
	}
	else
		a.href = 'useri/trimite_comanda.html';
}
function filterClear(){
	for(var i=0;i<$('filtru_form').elements.length;i++)
		if($('filtru_form').elements[i].type.toLowerCase()=='checkbox')
		{
			$('filtru_form').elements[i].checked=false;
			uncheckCheckbox($('filtru_form').elements[i].id);
		}
}
function cycleCheckbox(id){
	var ckb = $(id);
	if (ckb.checked)
		$(id+'_img').src = 'img/checkbox.gif';
	else $(id+'_img').src = 'img/checkboxchecked.gif';
	ckb.checked = !ckb.checked;
}
function uncheckCheckbox(id){
	var ckb = $(id);
	$(id+'_img').src = 'img/checkbox.gif';
}
var interval;
var initHeight = 500;
var up = 0;
var dist;
function animateDiv(div){
	div = document.getElementById(div);
	initHeight = div.getElementsByTagName("table")[0].offsetHeight;
	var display = div.style.display;
	var footer = $('footer');
	dist = dist * 1.2;
	if (up)
	{
		if (parseInt(div.style.height) < dist) {
			clearInterval(interval); div.style.height = 0; div.style.display = 'none';
			if (!footer.style.height)
				footer_style_height = 0;
			else
				footer_style_height = parseInt(footer.style.height);
			footer.style.height = Math.max(0, footer_style_height - initHeight);
		}
		else
		{
			div.style.height = parseInt(div.style.height) - dist;
		}
	}
	else
	{
		div.style.display = 'block';
		if (parseInt(div.style.height) > initHeight) {
			clearInterval(interval);
			div.style.height = initHeight;
			if (!footer.style.height)
				footer_style_height = 0;
			else
				footer_style_height = parseInt(footer.style.height);
			footer.style.height = Math.max(0, footer_style_height - initHeight);
		}
		else
		{
			div.style.height = parseInt(div.style.height) + dist;
		}
	}
}
function cycleDiv(id){
	var div = $(id);
	div.style.overflow = 'hidden';
	if (div.style.display != "none")
	{
		initHeight = div.getElementsByTagName("table")[0].offsetHeight;
	}
	ajax_settings_submit(id, up);
	div.style.height = div.offsetHeight;
	dist = 10;
	if (id == 'filters')
	{
		interval = setInterval("animateDiv('filters')", 1);
	}
	if (id == 'parerea_ta')
	{
		$('footer').style.height = $('footer').offsetHeight;
		if (!up) $('footer').style.height = parseInt($('footer').style.height) + initHeight;
		interval = setInterval("animateDiv('parerea_ta')", 1);
	}
	up = (up+1)%2;
	$('arrow_'+up).style.display = 'block';
	$('arrow_'+(up+1)%2).style.display = 'none';
}
function hideDiv(id){
	var div = $(id);
	if (div)
	{
		div.style.overflow = 'hidden';
		if (div.style.display == "none")
		{
			div.style.display = 'block';
			initHeight = div.offsetHeight;
			div.style.display = 'none';
		}
		ajax_settings_submit(id, up);
		div.style.height = div.offsetHeight;
		dist = 10;
		if (id == 'filters')
		{
			div.style.height = 0; div.style.display = 'none';
		}
		if (id == 'parerea_ta')
		{
			$('footer').style.height = $('footer').offsetHeight;
			div.style.height = 0; div.style.display = 'none';
		}
		up = 1;
		$('arrow_'+up).style.display = 'block';
		$('arrow_'+(up+1)%2).style.display = 'none';
	}
}
function change_rate(rate){
	document.fc.rate.value = rate;
	for (var i = 1; i <= rate; i++)
		document.getElementById("rate_" + i).src = 'img/star_on.jpg';
	for (var i = rate + 1; i <= 5; i++)
		document.getElementById("rate_" + i).src = 'img/star_off.jpg';
}
function highlight_rate(rate){
	for (var i = 1; i <= rate; i++)
		document.getElementById("rate_" + i).src = 'img/star_on.jpg';
	for (var i = rate + 1; i <= 5; i++)
		document.getElementById("rate_" + i).src = 'img/star_off.jpg';
}
function out_highlight_rate(rate){
	for (var i = 1; i <= document.fc.rate.value; i++)
		document.getElementById("rate_" + i).src = 'img/star_on.jpg';
	for (var i = parseInt(document.fc.rate.value) + 1; i <= 5; i++)
		document.getElementById("rate_" + i).src = 'img/star_off.jpg';
}
var ppSelected=0;
function ppPic(thumb, full, orig, wid){
	var idx=thumb*2;
	the_width = wid;
	document.getElementById('pp_thumb').rows[0].cells[ppSelected].className='';
	document.getElementById('pp_thumb').rows[0].cells[idx].className='selected';
	//document.getElementById('pp_image').src=full;
	document.getElementById('pp_image').style.backgroundImage="url('"+full+"')";
	document.getElementById('big_img_zoom').getElementsByTagName("img")[0].src=orig;
	ppSelected=idx;
}
function show3D(b,id,w,h){
	var scr1=null;
	var params='scrollbars=no,status=yes,innerWidth='+w+',width='+w+',height='+h;
	var scr1=window.open('3dview.html?id='+id,'trideewin'+id,params);
	scr1.moveTo(0,0);
	if(scr1.innerHeight)
	{
		scr1.resizeTo(w+(scr1.outerWidth-scr1.innerWidth),h+(scr1.outerHeight-scr1.innerHeight));
	}
	scr1.focus();
}
function link_from_inputs(form)
{
	var inps = form.getElementsByTagName('input');
	var ret = '';
	for (var i = 0; i < inps.length; i++)
	{
		if (inps[i].type == 'checkbox' && inps[i].checked)
			ret += inps[i].name + "=" + inps[i].value + "&";
		if (inps[i].type != 'checkbox' && inps[i].type != 'submit' && inps[i].type != 'button')
			ret += inps[i].name + "=" + inps[i].value + "&";
	}
	ret = ret.substr(0, ret.length-1);
	return ret;
}
/*function show_bigimg(id)
{
	document.getElementById('flash').style.display = 'none';
	document.getElementById('big_img_holder').style.display = 'block';
	document.getElementById(id).style.display = 'block';
}
function hide_bigimg()
{
	var imgs = document.getElementById('big_img_holder').getElementsByTagName('img');
	for (var i = 0; i < imgs.length; i++)
	{
		imgs[i].style.display = 'none';
	}
	document.getElementById('big_img_holder').style.display = "none";
	document.getElementById('flash').style.display = 'block';
}*/
function show_bigimg(id)
{
	if (shown_id.length)
	{
		document.getElementById(shown_id).style.display = 'none';
	}
	shown_id = id;
	clearTimeout(the_timer);
	/*document.getElementById('flash').style.display = 'none';*/
	document.getElementById('big_img_holder').style.display = 'block';
	document.getElementById(id).style.display = 'inline';
}
var the_timer;
var shown_id = "";
function hide_bigimg()
{
	the_timer = setTimeout("hide_bigimg2()", 100);
}
function hide_bigimg2()
{
	var imgs = document.getElementById('big_img_holder').getElementsByTagName('img');
	for (var i = 0; i < imgs.length; i++)
	{
		imgs[i].style.display = 'none';
	}
	document.getElementById('big_img_holder').style.display = "none";
	/*document.getElementById('flash').style.display = 'block';*/
}
function getFile(url, callback, post_keys, post_values, xml){
	try{ var xmlHttp=new XMLHttpRequest(); }   // Firefox, Opera 8.0+, Safari
	catch (e){
		// Internet Explorer
		try{ var xmlHttp=new ActiveXObject('MSXML2.XMLHTTP.3.0'); }
		catch(e){
			try{ var xmlHttp=new ActiveXObject('MSXML3.XMLHTTP'); }
			catch(e){
				try{ var xmlHttp=new ActiveXObject('Msxml2.XMLHTTP'); }
				catch(e){
					try{ var xmlHttp=new ActiveXObject('Microsoft.XMLHTTP'); }
					catch(e){
						throw new Error("Could not find an XMLHttpRequest alternative.");
					}
				}
			}
		}
	}
	var post_string='';
	if(post_keys){
		if(!post_values){
			for(var i in post_keys)
				post_string+=escape(i)+'='+post_keys[i]+'&';
		}
		else
			for(var i=0;i<post_keys.length;i++)
				post_string+=escape(post_keys[i])+'='+escape(post_values[i])+'&';
		post_string=post_string.substring(0, post_string.length-1);
	}
	xmlHttp.open(post_string?'POST':'GET', url, callback?true:false);
	if(post_string){
		xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		xmlHttp.setRequestHeader("Content-length", post_string.length);
		xmlHttp.setRequestHeader("Connection", "close");
		var method='POST';
	}
	if(callback){
		xmlHttp.onreadystatechange=function(){
			if(xmlHttp.readyState==4){
				if(xmlHttp.status==200)
					callback(xml?xmlHttp.responseXML.documentElement:xmlHttp.responseText);
				else
					throw new Error('Page returned error '+xmlHttp.status+' '+xmlHttp.statusText);
			}
		}
	}
	xmlHttp.send(post_string);
	if(!callback)
		return xml?xmlHttp.responseXML.documentElement:xmlHttp.responseText;
	else
		return 'Wait for async';
}
function tabArray(txt, sep, eol){
	if(!txt.length)
		return new Array();
	if(!eol)
		eol='\r\n';
	if(!sep)
		sep='\t';
	var arr=new Array();
	var lines=txt.split(eol)
	for(var i=0;i<lines.length;i++){
		var tmp=lines[i].split(sep);
		arr[tmp[0]]=tmp[1];
	}
	return arr;
}
function fillSelect(elm, keys, values, first_key, first_value, select){
	if(!values){ // keys is an associative array
		values=new Array();
		var k=new Array();
		for(var i in keys){
			k[k.length]=i;
			values[values.length]=keys[i];
		}
		keys=k;
	}
	elm.options.length=0;
	if(first_key || first_value)
		elm.options[elm.options.length]=new Option(first_value, first_key);
	if(!select)
		select=null;
	for(var i=0;i<keys.length;i++){
		elm.options[elm.options.length]=new Option(values[i], keys[i]);
		if(select==keys[i])
			elm.options[elm.options.length-1].selected=true;
	}
}
function fillSearchForm(type){
		if(type==0)
        	getFile('_serveme.php?tip='+document.forms['frmSearch'].elements['tip'].value,
            function(txt){
            	fillSelect(document.frmSearch.marca, tabArray(txt), false, false, false, 'toate tipurile');
                fillSearchForm(1);
            }
        );
        else if(type==1)
            getFile('_serveme.php?tip='+document.forms['frmSearch'].elements['tip'].value+'&marca='+document.forms['frmSearch'].elements['marca'].value,
            function(txt){
                fillSelect(document.frmSearch.model, tabArray(txt), false, false, false, 'toate marcile');
                fillSearchForm(2);
            }
        );
}
function show_popup(d)
{
	document.getElementsByTagName("body")[0].style.overflowY = "hidden";
	var height = document.body.clientHeight;
	if (height < 550)
	{
//		alert(height);
		var div_h = height - 60;
		document.getElementById("popup_opac_divid").getElementsByTagName("div")[0].style.height = div_h+'px';
		document.getElementById("the_q").style.height = (div_h - 80)+'px';
	}
	document.getElementById("popup_tran_" + d).style.display = "block";
	document.getElementById("popup_opac_" + d).style.display = "";
	//document.getElementById("popup_opac_" + d).style.display = "block";
	//document.getElementById("popup_opac_" + d).style.display = "table";
	document.getElementById("popup_tran_" + d).style.backgroundColor = eval ("bgcol_" + d);
	if (document.body.filters)
	{
		window.scroll(0, 0);
	}
}
function hide_popup(d)
{
	document.getElementsByTagName("body")[0].style.overflowY = "scroll";
	document.getElementById("popup_opac_" + d).style.display = "none";
	document.getElementById("popup_tran_" + d).style.display = "none";
}
function show_answer(q)
{
	var ans = document.getElementById('a'+q.id.substr(1));
	if (ans.style.display != 'block')
		ans.style.display = 'block';
	else
		ans.style.display = 'none';
}
function URLEncode(url){ //Function to encode URL.
    // Functiile Javascript escape si unescape nu corespund
    // cu ceea ce fac de fapt browserele...
    var SAFECHARS = "0123456789" + // Numeric
    "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + // Alphabetic
    "abcdefghijklmnopqrstuvwxyz" +
    "-_.!~*'()"; // RFC2396 Mark characters
    var HEX = "0123456789ABCDEF";
    var plaintext = url;
    var encoded = "";
    for (var i = 0; i < plaintext.length; i++ ) {
        var ch = plaintext.charAt(i);
        if (ch == " ") {
            encoded += "+"; // x-www-urlencoded, mai degraba, decat %20
        } else if (SAFECHARS.indexOf(ch) != -1) {
            encoded += ch;
        } else {
            var charCode = ch.charCodeAt(0);
            if (charCode > 255) {
                ;
            } else {
                encoded += "%";
                encoded += HEX.charAt((charCode >> 4) & 0xF);
                encoded += HEX.charAt(charCode & 0xF);
            }
        }
    }
    return encoded;
}
function for_ticketing(form, action)
{
	var inp = form.for_ticket;
	if (inp.checked)
	{
		var newAttr = document.createAttribute("action");
	    newAttr.nodeValue = "ticketing/open.php";
	    form.setAttributeNode(newAttr);
	}
	else
	{
		var newAttr = document.createAttribute("action");
	    newAttr.nodeValue = action;
	    form.setAttributeNode(newAttr);
	}
}
/*perf*/
function perf_browser_details()
{
	var xmlHttp = GetXmlHttpObject();
	if (xmlHttp == null)
		return;
	xmlHttp.open ("GET", "__perf_browser_details.php?id=" + request_id + "&stie_flash=" + stie_flash, true);
	xmlHttp.send (null);
}
function perf_dom_loaded()
{
	var xmlHttp = GetXmlHttpObject();
	if (xmlHttp == null)
		return;
	xmlHttp.open ("GET", "__perf_dom_loaded.php?id=" + request_id + "&start_time=" + start_time, true);
	xmlHttp.send (null);
}
function resolve_ip_old()
{
	var xmlHttp = GetXmlHttpObject();
	if (xmlHttp == null)
		return;
	xmlHttp.open ("GET", "__perf_user_ip.php?id=" + request_id + "&user_ip=" + user_ip, true);
	xmlHttp.send (null);
}
function perf_flash_loaded_old()
{
	if (!perf_flash_saved)
	{
		perf_flash_saved = true;
		var xmlHttp = GetXmlHttpObject();
		if (xmlHttp == null)
			return;
		xmlHttp.open ("GET", "__perf_flash_loaded.php?id=" + request_id + "&start_time=" + start_time, true);
		xmlHttp.send (null);
	}
}
function perf_flash_loaded()
{
	if (document.getElementById("perform_flash_load"))
	{
		if (!perf_flash_saved)
		{
			perf_flash_saved = true;
			document.getElementById("perform_flash_load").src = 'i/stats.js.php?action=flash_load&id=' + request_id;
		}
	}
}
function resolve_ip()
{
	document.getElementById("perform_ip").src = 'i/stats.js.php?action=resolve_ip&id=' + request_id + '&user_ip=' + user_ip;
}
function stie_ajax()
{
	var xmlHttp = GetXmlHttpObject();
	if (xmlHttp == null)
		return;
	document.getElementById("perform_ajax").src = 'i/stats.js.php?action=stie_ajax&id=' + request_id;
}
function check_flash_working()
{
	document.getElementById("perform_flash").src = 'i/stats.js.php?action=stie_flash&id=' + request_id;
}
/*/perf*/
//LIVESEARCH.js
	/*
// +----------------------------------------------------------------------+
// | Copyright (c) 2004 Bitflux GmbH                                      |
// +----------------------------------------------------------------------+
// | Licensed under the Apache License, Version 2.0 (the "License");      |
// | you may not use this file except in compliance with the License.     |
// | You may obtain a copy of the License at                              |
// | http://www.apache.org/licenses/LICENSE-2.0                           |
// | Unless required by applicable law or agreed to in writing, software  |
// | distributed under the License is distributed on an "AS IS" BASIS,    |
// | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or      |
// | implied. See the License for the specific language governing         |
// | permissions and limitations under the License.                       |
// +----------------------------------------------------------------------+
// | Author: Bitflux GmbH <devel@bitflux.ch>                              |
// +----------------------------------------------------------------------+
*/
var LShref=false;
var liveSearchReq = false;
var t = null;
var liveSearchLast = "";
var LSMinimumCharacters=3;
var isIE = false;
// on !IE we only have to initialize it once
if(window.XMLHttpRequest) {
	liveSearchReq = new XMLHttpRequest();
}
function liveSearchInit() {
	if(!$('livesearch'))
		return;
	if(navigator.userAgent.indexOf("Safari") > 0) {
		$('livesearch').addEventListener("keydown",liveSearchKeyPress,false);
//		$('livesearch').addEventListener("blur",liveSearchHide,false);
	} else if(navigator.product == "Gecko") {
		$('livesearch').addEventListener("keypress",liveSearchKeyPress,false);
		$('livesearch').addEventListener("blur",liveSearchHideDelayed,false);
	} else {
		$('livesearch').attachEvent('onkeydown',liveSearchKeyPress);
		$('livesearch').attachEvent("onblur",liveSearchHide,false);
		isIE = true;
	}
	$('livesearch').setAttribute("autocomplete","off");
}
function liveSearchHideDelayed() {
	window.setTimeout("liveSearchHide()",400);
}
function liveSearchHide() {
	$("LSResult").style.display = "none";
	var highlight = $("LSHighlight");
	if(highlight) {
		highlight.removeAttribute("id");
	}
}
function liveSearchKeyPress(event) {
	if(event.keyCode == 40 )
	//KEY DOWN
	{
		highlight = $("LSHighlight");
		if(!highlight) {
			highlight = $("LSShadow").firstChild.firstChild;
		} else {
			highlight.removeAttribute("id");
			highlight = highlight.nextSibling;
		}
		if(highlight) {
			highlight.setAttribute("id","LSHighlight");
		}
		if(!isIE) { event.preventDefault(); }
	}
	//KEY UP
	else if(event.keyCode == 38 ) {
		highlight = $("LSHighlight");
		if(!highlight) {
			highlight = $("LSResult").firstChild.firstChild.lastChild;
		}
		else {
			highlight.removeAttribute("id");
			highlight = highlight.previousSibling;
		}
		if(highlight) {
				highlight.setAttribute("id","LSHighlight");
		}
		if(!isIE) { event.preventDefault(); }
	}
	//ESC
	else if(event.keyCode == 27) {
		highlight = $("LSHighlight");
		if(highlight) {
			highlight.removeAttribute("id");
		}
		$("LSResult").style.display = "none";
	}
	//BACKSPACE - required for IE
	else if(event.keyCode == 8 && isIE) {
		liveSearchStart();
	}
	//RETURN
	else if(event.keyCode == 13 ) {
		return liveSearchSubmit();
	}
}
function liveSearchStart(){
	if(t){
		window.clearTimeout(t);
	}
	if(document.forms.searchform.q.value.length >= LSMinimumCharacters-1)
		$('LSLoading').className='LSLoadingOn';
	t = window.setTimeout("liveSearchDoSearch()",400);
}
function liveSearchDoSearch() {
	if(typeof liveSearchRoot == "undefined") {
		liveSearchRoot = "";
	}
	if(typeof liveSearchRootSubDir == "undefined") {
		liveSearchRootSubDir = "";
	}
	if(typeof liveSearchParams == "undefined") {
		liveSearchParams2 = "";
	} else {
		liveSearchParams2 = "&" + liveSearchParams;
	}
	if((liveSearchLast != document.forms.searchform.q.value) && (document.forms.searchform.q.value.length >= LSMinimumCharacters)){
		if(liveSearchReq && liveSearchReq.readyState < 4) {
			liveSearchReq.abort();
		}
		if( document.forms.searchform.q.value == "") {
			liveSearchHide();
			liveSearchLast = "";
			return false;
		}
		if(window.XMLHttpRequest) { // branch for IE/Windows ActiveX version
		}
		else if(window.ActiveXObject) {
			liveSearchReq = new ActiveXObject("Microsoft.XMLHTTP");
		}
		liveSearchReq.onreadystatechange= liveSearchProcessReqChange;
		liveSearchReq.open("GET", base_href + "livesearch.php?q=" + escape(document.forms.searchform.q.value) + liveSearchParams2);
		liveSearchLast = document.forms.searchform.q.value;
		liveSearchReq.send(null);
	}
	else{
		$('LSLoading').className='LSLoadingOff';
	}
}
function liveSearchProcessReqChange() {
	if(liveSearchReq.readyState == 4) {
		var  res = $("LSResult");
		res.style.display = "block";
		var  sh = $("LSShadow");
		sh.innerHTML = liveSearchReq.responseText;
	}
	$('LSLoading').className='LSLoadingOff';
}
function liveSearchSubmit() {
	var highlight = $("LSHighlight");
	if(highlight && highlight.firstChild) {
		window.location =highlight.firstChild.nextSibling.getAttribute("href");
		return false;
	}
	else {
		return true;
	}
}
function preview(request){
    //
    var previewNode = $('previewComment');
    if(!previewNode) {
        var lastComment = $('bx_foo');
        var previewNode = document.createElement("div");
        previewNode.id = 'previewComment';
        previewNode.className = 'post_content';
        previewNode = lastComment.parentNode.insertBefore(previewNode,lastComment.nextSibling);
    }
    previewNode.innerHTML = request.responseText;
}
function previewSubmit(test) {
    var name = $('name').value;
    var mail = $('email').value;
    var uri = $('openid_url').value;
    var text = document.forms['bx_foo']['comments'].value;
    var f = document.forms['commentForm'];
	if(typeof liveSearchRoot == "undefined") {
		var liveSearchRoot = "/";
	}
    body = "mail=" + encodeURIComponent(mail) + "&uri="+ encodeURIComponent(uri) + "&text="+ encodeURIComponent(text) + "&name="+ encodeURIComponent(name);
    new ajax (liveSearchRoot + 'inc/bx/php/preview.php', {
        postBody: body,
                method: 'post',
                onComplete: preview
    });
    return false;
}
document.onmousedown=function(){
	if(LShref!=false && LShref!=null){
		document.location=LShref;
	}
}
// END LIVE SEARCH

function sterge_wishlist(id_user, id_div, id_wish, id_prieten)
{
	var xmlHttp = GetXmlHttpObject();
	if (xmlHttp == null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	}
	xmlHttp.onreadystatechange = function()
	{
		if(xmlHttp.readyState == 4)
		{
			document.getElementById(id_div).innerHTML = xmlHttp.responseText;
			document.getElementById('delete_all_wishes').removeAttribute('onclick');
		}
	}
	xmlHttp.open ("GET", "_sterge_wishlist.php?user="+id_user+"&wish="+id_wish+"&friend="+id_prieten, true);
	xmlHttp.send (null);
}
function select_sterge(id)
{
	var div = document.getElementById('sterge_'+id);
	var holder = div.parentNode;
	var width = holder.offsetWidth;
	var height = holder.offsetHeight;
	div.style.width = width+'px';
	div.style.height = height+'px';
	div.getElementsByTagName('p')[0].style.height = height+'px';
	div.style.display = 'block';
	document.getElementById('sterge['+id+']').value = 'true';
}
function undelete(id)
{
	var div = document.getElementById('sterge_'+id);
	div.style.display = 'none';
	var input = document.getElementById('sterge['+id+']');
	input.value = 'false';
}
function show_wishlist_button(txt)
{
	var div = document.getElementById('wish_btns');
	if (txt.substr(0, 23) == 'Produsul a fost adaugat' && div.getElementsByTagName('a').length == 0)
	{
		div.innerHTML += "<a href='"+ base_href +"useri/wishlist.html'><img src='img/vezi_wishlist.gif' alt='vezi wishlist' style='border: 0; padding-bottom: 1px;' /></a>";
	}
}

function iaPozitia(e)
{
	if (!e.offsetParent)
		e = $(e);
	var left = 0;
	var top = 0;
	while (e.offsetParent)
	{
		left += e.offsetLeft;
		top += e.offsetTop;
		e = e.offsetParent;
	}
	left += e.offsetLeft;
	top += e.offsetTop;
	return {x : left, y : top};
}
function AssignPosition_Shirts(d)
{
	if(document.documentElement && document.documentElement.scrollTop)
		rX = document.documentElement.scrollLeft;
	else if(document.body)
		rX = document.body.scrollLeft;
	else if(self.pageYOffset)
		rX = self.pageXOffset;
	if(document.all)
		cX += rX;
	var poz = iaPozitia(d);
	poz = cX - poz.x;
	poz = Math.max(1, Math.min(5, Math.floor(poz * 5 / d.offsetWidth) + 1));
	var cul_lim = d.getAttribute("culori");
	if (!((cul_lim.length > 0) && (cul_lim.indexOf(poz) == -1)))
	{
		var t_src = d.src.replace(/(.*?)\-([a-z]+)\.jpg/, "$1-" + shirts_colors[poz] + ".jpg");
		if (d.src != t_src)
		{
			d.src = t_src;
			change_cul("my_t_" + d.getAttribute("id"), poz, d.getAttribute("sex"), d.getAttribute("t_id"));
		}
	}
}
var images_to_preload = Array();
var tshirts_prices = {};
function preload_images()
{
	for (var i = 0; i < images_to_preload.length; i++)
	{
		var img = new Image();
		img.src = images_to_preload[i];
	}
}
function hide_livesearch()
{
	var div = document.getElementById('LSResult');
	if (div.style.display == 'block')
		div.style.display = 'none';
}


	function change_png_image(img)
	{
		var imgID = (img.id) ? "id='" + img.id + "' " : "";
		var imgClass = (img.className) ? "class='" + img.className + "' " : "";
		var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' ";
		/*if (!img.style)
		{
			debugger;
			img.style = {};
			img.style.cssText = '';
		}
		if (!img.style.cssText)
			img.style.cssText = '';*/
		var imgStyle = "display:inline-block; background-image: none; " + img.style.cssText ;
		if (img.align == "left") imgStyle = "float:left;" + imgStyle;
		if (img.align == "right") imgStyle = "float:right;" + imgStyle;
		if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle;
		var strNewHTML = "<img src='i/b.gif' " + imgID + imgClass + imgTitle
			+ " style=\"" + "width:" + 431 + "px; height:" + 430 + "px;" + imgStyle + ";"
			+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
			+ "(src=\'" + img.src + "\', sizingMethod='crop');\" />";
		img.outerHTML = strNewHTML;
	}
	function get_img_src(img)
	{
		if (ie_version)
		{
			if (!img.style)
				img.style = {};
			if (img.style["filter"])
			{
				var the_src = img.style["filter"].match(/src=\'([^\']*)/i);
				if (the_src)
					return the_src[1];
				return "";
			}
			return "";
		}
		return img.src;
	}
	function set_img_src(img, src, da)
	{
		if (ie_version && da)
		{
			var imgID = (img.id) ? "id='" + img.id + "' " : "";
			var imgClass = (img.className) ? "class='" + img.className + "' " : "";
			var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' ";
			/*if (!img.style)
			{
				img.style = {};
				img.style.cssText = '';
			}
			if (!img.style.cssText)
				img.style.cssText = '';*/
			if (img.style["filter"] && img.style["filter"].length)
				img.style["filter"] = "progid:DXImageTransform.Microsoft.AlphaImageLoader"
				+ "(src=\'" + src + "\', sizingMethod='crop')";
			var imgStyle = "display:inline-block; background-image: none; " + img.style.cssText;
			if (img.align == "left") imgStyle = "float:left;" + imgStyle;
			if (img.align == "right") imgStyle = "float:right;" + imgStyle;
			if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle;
			var strNewHTML = "<img src='i/b.gif' " + imgID + imgClass + imgTitle
				+ " style=\"" + "width:" + 431 + "px; height:" + 430 + "px;" + imgStyle + ";"
				+ "\" />";
			img.outerHTML = strNewHTML;
		}
		else
			img.src = src;
	}
	function alege_marime(marime, cont)
	{
		if ((typeof (x = in_stoc[sel_model]) != "undefined") && (typeof (y = x[marime]) != "undefined") && (typeof (z = y["in_stoc"]) != "undefined"))
		{
			if (z > 0)
			{
				the_end = false;
				alg_fata();
				if (sel_marime)
					document.getElementById(sel_marime + "_checked").style.display = "none";
				if ((sel_model) && (sel_model == "hanorac"))
				{
					document.getElementById("hanorac_over").style.display = "none";
					if (are_spate)
						document.getElementById("hanorac_over_spate").style.display = "none";
				}
				var old_culoare = def_culoare;
				if (sel_culoare && (sel_culoare != "unselected"))
				{
					if (document.getElementById("culoare_" + sel_culoare).className == "seld")
						document.getElementById("culoare_" + sel_culoare).className = "";
					old_culoare = sel_culoare;
				}
				sel_culoare = def_culoare;
				setTimeout( function()
					{
						var the_imgs = document.getElementById("marimea").getElementsByTagName("img");
						for (var i = 0; i < the_imgs.length; i++)
							if (the_imgs[i].alt != "checked")
								the_imgs[i].src = the_imgs[i].src.replace(old_culoare, sel_culoare);
					}, 1);
				setTimeout( function()
					{
						var the_imgs = document.getElementById("modelul").getElementsByTagName("img");
						for (var i = 0; i < the_imgs.length; i++)
							if (the_imgs[i].alt != "checked")
								the_imgs[i].src = the_imgs[i].src.replace(old_culoare, sel_culoare);
					}, 1);
				setTimeout( function()
					{
						set_img_src(document.getElementById("tricou_fata"), base_href + def_tricou_fata, true);
						if (are_spate)
							set_img_src(document.getElementById("tricou_spate"), base_href + def_tricou_spate, true);
						set_img_src(document.getElementById("tricoul_bg"), base_href + "i/js/trikos/" + sel_model + "-disabled.png", true);
						document.getElementById("text_marimea").src = "i/js/text_marimea.gif";
						document.getElementById("text_culoarea").src = "i/js/text_alege_culoarea.gif";
						document.getElementById("text_modelul").src = "i/js/text_modelul.gif";
					}, 1);
				sel_marime = marime;
				document.getElementById(sel_marime + "_checked").style.display = "block";
				document.getElementById("seld_marime").innerHTML = ", " + marime.toUpperCase();
				get_tshirt_price_2(id_tricou, sel_model, sel_marime, "all", "price_big");
				document.getElementById("seld_culoare").innerHTML = "";
				document.getElementById("seld_logo").innerHTML = "";
				document.getElementById("logo_fata").style.display = "none";
				if (are_spate)
					document.getElementById("logo_spate").style.display = "none";
				stop_fifo("text_marimea");
				texts[1] = "i/js/text_alege_culoarea.gif";
				the_text_ind = 0;
				fade_in_fade_out("text_culoarea", -1);
				document.getElementById("culoarea").style.display = "block";
				document.getElementById("logo").style.display = "none";
				document.getElementById("vreau_logo").checked = false;
				get_potriviri(trans_sex[sel_model], sel_marime, true);
				document.getElementById("adauga").className = "unseld";
				document.getElementById("audaga_cos").src = document.getElementById("audaga_cos").src.replace("_on", "_off");
				location.hash = "#model-" + sel_model + "_marime-" + marime;
				var the_loc = location.href;
				var the_ym_link = document.getElementById("send_ym");
				var the_tf_link = document.getElementById("send_tf");
				var to_change = the_ym_link.href.match(/\+http[^\+]*\+/i);
				the_ym_link.href = the_ym_link.href.replace(to_change, "+" + the_loc + "+");
				if ((typeof (z = y["got_stocs"]) != "undefined") && (z > 0))
					afiseaza_culori(cont);
				else
					get_culori_stocs(cont);
			}
			else
				return;
		}
	}
	function get_marimi_stocs(cont)
	{
		var xmlHttp = GetXmlHttpObject();
		if (xmlHttp == null)
		{
			alert ("Your browser does not support AJAX!");
			return;
		}
		xmlHttp.onreadystatechange = function()
		{
			if(xmlHttp.readyState == 4)
			{
				eval(xmlHttp.responseText);
				if (typeof (z = in_stoc[sel_model]) == "undefined")
					in_stoc[sel_model] = {};
				in_stoc[sel_model]["got_stocs"] = 1;
				afiseaza_marimi(cont);
			}
		}
		xmlHttp.open ("GET", "__get_stocinfo.php?tricou=" + nume_tricou + "&action=marimi&model=" + sel_model, true);
		xmlHttp.send (null);
	}
	function afiseaza_marimi(cont)
	{
		var the_div = document.getElementById("marimea");
		var the_imgs = the_div.getElementsByTagName("img");
		setTimeout( function()
			{
				for (var i = 1; i < the_imgs.length; i++)
					if (the_imgs[i].alt != "checked")
					{
						var pos_en = the_imgs[i].src.lastIndexOf("-");
						var the_marime = the_imgs[i].alt;
						if (in_stoc[sel_model][the_marime]["in_stoc"] == 0)
						{
							document.getElementById("marime_" + the_marime).style.display = "none";
							the_imgs[i].style.cursor = "default";
							the_imgs[i].src = the_imgs[i].src.substr(0, pos_en + 1) + "disabled.gif";
						}
						else
						{
							document.getElementById("marime_" + the_marime).style.display = "block";
							the_imgs[i].style.cursor = "pointer";
							the_imgs[i].src = the_imgs[i].src.substr(0, pos_en + 1) + sel_culoare + ".gif";
						}
					}
			}, 1);
		the_div.style.display = "block";
		if (cont && (typeof (x = the_dets["marime"]) != "undefined"))
			alege_marime(x, true);
		else
			if (only_spate)
				alg_spate();
	}
	function alege_modelul(model, cont)
	{
		if ((typeof (x = in_stoc[model]) != "undefined") && (typeof (y = x["in_stoc"]) != "undefined"))
		{
			if (y > 0)
			{
				the_end = false;
				alg_fata();
				var old_model = "mascul";
				if (sel_model)
				{
					/* AICI TREBE VAZUT DACA SUNT SI ALTE ELEMENTE SPECIALE SAU CEVA DACA FACEM DIFERIT
					DEOCAMDATA RAMANE ASA */
					if (sel_model == "hanorac")
					{
						document.getElementById("hanorac_over").style.display = "none";
						if (are_spate)
							document.getElementById("hanorac_over_spate").style.display = "none";
					}
					document.getElementById("model_" + sel_model + "_checked").style.display = "none";
					old_model = sel_model;
				}
				var old_culoare = def_culoare;
				if (sel_culoare && (sel_culoare != "unselected"))
				{
					if (document.getElementById("culoare_" + sel_culoare).className == "seld")
						document.getElementById("culoare_" + sel_culoare).className = "";
					old_culoare = sel_culoare;
				}
				if (sel_marime && (sel_marime != "unselected"))
					document.getElementById(sel_marime + "_checked").style.display = "none";
				sel_culoare = def_culoare;
				setTimeout( function()
					{
						var the_imgs = document.getElementById("marimea").getElementsByTagName("img");
						for (var i = 0; i < the_imgs.length; i++)
							if (the_imgs[i].alt != "checked")
								the_imgs[i].src = the_imgs[i].src.replace(old_culoare, sel_culoare);
					}, 1);
				setTimeout( function()
					{
						var the_imgs = document.getElementById("modelul").getElementsByTagName("img");
						for (var i = 0; i < the_imgs.length; i++)
							if (the_imgs[i].alt != "checked")
								the_imgs[i].src = the_imgs[i].src.replace(old_culoare, sel_culoare);
					}, 1);
				sel_model = model;
				setTimeout( function()
					{
						var the_imgs = document.getElementById("marimea").getElementsByTagName("img");
						for (var i = 0; i < the_imgs.length; i++)
							if (the_imgs[i].alt != "checked")
								the_imgs[i].src = the_imgs[i].src.replace(old_model, sel_model);
					}, 1);
				setTimeout( function()
					{
						/*AQUI*/
						set_img_src(document.getElementById("tricou_fata"), base_href + def_tricou_fata, true);
						//document.getElementById("tricou_fata").src = base_href + def_tricou_fata;
						if (are_spate)
							set_img_src(document.getElementById("tricou_spate"), base_href + def_tricou_spate, true);
							//document.getElementById("tricou_spate").src = def_tricou_spate;
						set_img_src(document.getElementById("tricoul_bg"), base_href + "i/js/trikos/" + sel_model + "-disabled.png", true);
						//document.getElementById("tricoul_bg").src = "i/b.gif";
						document.getElementById("text_culoarea").src = "i/js/text_alege_culoarea.gif";
						document.getElementById("text_modelul").src = "i/js/text_modelul.gif";
					}, 1);
				document.getElementById("model_" + sel_model + "_checked").style.display = "block";
				var ucf_str_model = sel_model;
			    var f = ucf_str_model.charAt(0).toUpperCase();
			    ucf_str_model = f + ucf_str_model.substr(1);
				document.getElementById("logo_fata").style.display = "none";
				if (are_spate)
					document.getElementById("logo_spate").style.display = "none";
				document.getElementById("seld_marime").innerHTML = "";
				document.getElementById("seld_model").innerHTML = ", " + ucf_str_model;
				get_tshirt_price_2(id_tricou, sel_model, "all", "all", "price_big");
				document.getElementById("seld_culoare").innerHTML = "";
				document.getElementById("seld_logo").innerHTML = "";
				stop_fifo("text_modelul");
				texts[1] = "i/js/text_alege_marimea.gif";
				the_text_ind = 0;
				fade_in_fade_out("text_marimea", -1);
				document.getElementById("culoarea").style.display = "none";
				document.getElementById("marimea").style.display = "none";
				document.getElementById("logo").style.display = "none";
				document.getElementById("vreau_logo").checked = false;
				document.getElementById("potriviri").innerHTML = '';
				document.getElementById("adauga").className = "unseld";
				setTimeout( function()
				{
					document.getElementById("audaga_cos").src = document.getElementById("audaga_cos").src.replace("_on", "_off");
				}, 1);
				location.hash = "#model-" + sel_model;
				var the_loc = location.href;
				var the_ym_link = document.getElementById("send_ym");
				var the_tf_link = document.getElementById("send_tf");
				var to_change = the_ym_link.href.match(/\+http[^\+]*\+/i);
				the_ym_link.href = the_ym_link.href.replace(to_change, "+" + the_loc + "+");
				if ((typeof (z = x["got_stocs"]) != "undefined") && (z > 0))
					afiseaza_marimi(cont);
				else
					get_marimi_stocs(cont);
			}
			else
				return;
		}
	}
	function get_culori_stocs(cont)
	{
		var xmlHttp = GetXmlHttpObject();
		if (xmlHttp == null)
		{
			alert ("Your browser does not support AJAX!");
			return;
		}
		xmlHttp.onreadystatechange = function()
		{
			if(xmlHttp.readyState == 4)
			{
				eval(xmlHttp.responseText);
				if (typeof (z = in_stoc[sel_model]) != "undefined")
				{
					if (typeof (zz = z[sel_marime]) == "undefined")
						in_stoc[sel_model][sel_marime] = {};
					in_stoc[sel_model][sel_marime]["got_stocs"] = 1;
				}
				else
				{
					in_stoc[sel_model] = {};
					in_stoc[sel_model][sel_marime] = {};
					in_stoc[sel_model][sel_marime]["got_stocs"] = 1;
				}
				afiseaza_culori(cont);
			}
		}
		xmlHttp.open ("GET", "__get_stocinfo.php?tricou=" + nume_tricou + "&action=culori&marime=" + sel_marime + "&model=" + sel_model, true);
		xmlHttp.send (null);
	}
	function afiseaza_culori(cont)
	{
		var the_div = document.getElementById("culoarea");
		var the_imgs = the_div.getElementsByTagName("img");
		setTimeout( function()
			{
				for (var i = 1; i < the_imgs.length; i++)
				{
					var the_culoare = the_imgs[i].alt;
					if (in_stoc[sel_model][sel_marime][the_culoare]["in_stoc"] == 0)
					{
						the_imgs[i].parentNode.className = "dis";
						the_imgs[i].src = "i/b.gif";
						the_imgs[i].parentNode.style.display = "none";
					}
					else
					{
						if (the_imgs[i].parentNode.className != "seld")
							the_imgs[i].parentNode.className = "";
						the_imgs[i].src = "i/js/culoare-" + the_culoare + ".gif";
						the_imgs[i].parentNode.style.display = "block";
					}
				}
			}, 1);
		the_div.style.display = "block";
		if (cont && (typeof (x = the_dets["culoare"]) != "undefined"))
			alege_culoarea(x, true);
		else
			if (only_spate)
				alg_spate();
	}
	function alege_culoarea(culoare, cont)
	{
		if ((typeof (x = in_stoc[sel_model]) != "undefined") && (typeof (xx = x[sel_marime]) != "undefined") && (typeof (y = xx[culoare]) != "undefined") && (typeof (z = y["in_stoc"]) != "undefined"))
		{
			if (z > 0)
			{
				var old_culoare = def_culoare;
				alg_fata();
				if (sel_culoare && (sel_culoare != "unselected"))
				{
					if (document.getElementById("culoare_" + sel_culoare).className == "seld")
						document.getElementById("culoare_" + sel_culoare).className = "";
					old_culoare = sel_culoare;
				}
				sel_culoare = culoare;
				setTimeout( function()
					{
						var the_imgs = document.getElementById("marimea").getElementsByTagName("img");
						for (var i = 0; i < the_imgs.length; i++)
							if (the_imgs[i].alt != "checked")
								the_imgs[i].src = the_imgs[i].src.replace(old_culoare, sel_culoare);
					}, 1);
				setTimeout( function()
					{
						var the_imgs = document.getElementById("modelul").getElementsByTagName("img");
						for (var i = 0; i < the_imgs.length; i++)
							if (the_imgs[i].alt != "checked")
								the_imgs[i].src = the_imgs[i].src.replace(old_culoare, sel_culoare);
					}, 1);
				setTimeout( function()
					{
						/*AQUI*/
						set_img_src(document.getElementById("tricou_fata"), base_href + "i/tricouri/t/" + nume_tricou + "-" + sel_culoare + ".png");
						//document.getElementById("tricou_fata").src = "i/tricouri/t/" + nume_tricou + "-" + sel_culoare + ".png";
						if (are_spate)
							set_img_src(document.getElementById("tricou_spate"), base_href + "i/tricouri/t/" + nume_tricou + "-" + sel_culoare + "-sp.png");
							//document.getElementById("tricou_spate").src = "i/tricouri/t/" + nume_tricou + "-" + sel_culoare + "-sp.png";
						set_img_src(document.getElementById("tricoul_bg"), base_href + "i/js/trikos/" + sel_model + "-" + sel_culoare + ".png");
						//document.getElementById("tricoul_bg").src = "i/js/trikos/" + sel_model + "-" + sel_culoare + ".png";
						if (ie_version) 
						{
							var img = document.getElementById("tricou_fata");
							change_png_image(img);
							if (are_spate)
							{
								var img = document.getElementById("tricou_spate");
								change_png_image(img);
							}
							var img = document.getElementById("tricoul_bg");
							change_png_image(img);
						}
						document.getElementById("text_culoarea").src = "i/js/text_culoarea.gif";
					}, 1);
				document.getElementById("culoare_" + sel_culoare).className = "seld";
				var ucf_str_model = sel_culoare;
			    var f = ucf_str_model.charAt(0).toUpperCase();
			    ucf_str_model = f + ucf_str_model.substr(1);
				document.getElementById("seld_culoare").innerHTML = ", " + ucf_str_model;
				get_tshirt_price_2(id_tricou, sel_model, sel_marime, sel_culoare, "price_big");
				stop_fifo("text_culoarea");
				document.getElementById("adauga").className = "seld";
				setTimeout( function()
				{
					document.getElementById("audaga_cos").src = document.getElementById("audaga_cos").src.replace("_off", "_on");
				}, 1);
				/* AICI TREBE VAZUT DACA SUNT SI ALTE ELEMENTE SPECIALE SAU CEVA DACA FACEM DIFERIT
				DEOCAMDATA RAMANE ASA */
				if (sel_model == "hanorac")
				{
					document.getElementById("hanorac_over").style.display = "block";
					if (are_spate)
						document.getElementById("hanorac_over_spate").style.display = "block";
				}
				if ((sel_model == "mascul") || (sel_model == "femela") || (sel_model == "extra"))
				{
					document.getElementById("logo").style.display = "block";
					document.getElementById("seld_logo").innerHTML = "";
					document.getElementById("vreau_logo").checked = false;
					document.getElementById("logo_fata").style.display = "block";
					setTimeout( function()
						{
						/*AQUI*/
							set_img_src(document.getElementById("logo_fata"), base_href + "i/js/logo-" + sel_model + "-" + sel_culoare + ".png");
							//document.getElementById("logo_fata").src = "i/js/logo-" + sel_model + "-" + sel_culoare + ".png";
							if (are_spate)
								set_img_src(document.getElementById("logo_spate"), base_href + "i/js/logo-" + sel_model + "-" + sel_culoare + "-sp.png");
								//document.getElementById("logo_spate").src = "i/js/logo-" + sel_model + "-" + sel_culoare + "-sp.png";
							if (ie_version) 
							{
								var img = document.getElementById("logo_fata");
								change_png_image(img);
								if (are_spate)
								{
									var img = document.getElementById("logo_spate");
									change_png_image(img);
								}
							}
						}, 1);
				}
				else
				{
					document.getElementById("logo_fata").style.display = "none";
					if (are_spate)
						document.getElementById("logo_spate").style.display = "none";
				}
				the_end = true;
				location.hash = "#model-" + sel_model + "_marime-" + sel_marime + "_culoare-" + sel_culoare;
				var the_loc = location.href;
				var the_ym_link = document.getElementById("send_ym");
				var the_tf_link = document.getElementById("send_tf");
				var to_change = the_ym_link.href.match(/\+http[^\+]*\+/i);
				the_ym_link.href = the_ym_link.href.replace(to_change, "+" + the_loc + "+");
				if (only_spate)
					alg_spate();
				/*if (cont && (typeof (x = the_dets["logo"]) != "undefined"))
					vreau_logo_changed(true);*/
			}
			else
				return;
		}
	}
	function vreau_logo_changed(chk)
	{
		//var the_loc = location.protocol + '//' + location.host + location.pathname + location.search + "#marime-" + sel_marime + "_model-" + sel_model + "_culoare-" + sel_culoare;
		if (chk)
		{
			document.getElementById("vreau_logo").checked = true;
			document.getElementById("logo_fata").style.display = "none";
			if (are_spate)
				document.getElementById("logo_spate").style.display = "none";
			//the_loc += "_logo-fara"
			document.getElementById("seld_logo").innerHTML = ", fara logo pe maneca (+5 roni)";
			document.getElementById("price_big").innerHTML = parseInt(document.getElementById("price_big").innerHTML) + 5;
		}
		else
		{
			document.getElementById("vreau_logo").checked = false;
			if (are_spate && (sel_parte == "spate"))
				document.getElementById("logo_spate").style.display = "block";
			else
				document.getElementById("logo_fata").style.display = "block";
			document.getElementById("seld_logo").innerHTML = "";
			document.getElementById("price_big").innerHTML = parseInt(document.getElementById("price_big").innerHTML) - 5;
		}
		/*addthis_url = the_loc;
		if(navigator.appVersion.search(/MSIE 6.0/)==-1)
			document.location.href = the_loc;
		var the_ym_link = document.getElementById("send_ym");
		var the_tf_link = document.getElementById("send_tf");
		var to_change = the_ym_link.href.match(/\+http[^\+]*\+/i);
		the_ym_link.href = the_ym_link.href.replace(to_change, "+" + the_loc + "+");*/
	}
	
	function get_tshirt_price_2(id, sex, marime, culoare, el)
	{
		if (culoare != "all")
		{
			culoare = trans_culoare[culoare];
		}
		if (sex != "all")
			sex = trans_sex[sex];
		if (marime != "all")
			marime = trans_marime[marime];
		get_tshirt_price(id, sex, marime, culoare, el);
	}
	function add_to_cart()
	{
		if (the_end)
			location.href = base_href + "useri/adauga_in_cos.html?model=" + nume_tricou + "&sex=" + trans_sex[sel_model] + "&culoare=" + trans_culoare[sel_culoare] + "&marime=" + sel_marime + ((document.getElementById("vreau_logo").checked) ? "&fara_logo=true" : "") + ((cu_reducere) ? "&din_oferta=true" : "");
	}
	function add_to_wishlist()
	{
		if (the_end)
			{}
	}
	function setOpacity(el, value)
	{
    	element = document.getElementById(el);
    	var set_value = (value === '') ? '0' : (value < 0.00001) ? 0 : value;
    	element.style.opacity = set_value;
    	element.style.filter  = "alpha(opacity=" + parseInt(set_value * 100) + ")";
    	element.opac = set_value;
	}
	function getOpacity(el)
	{
		var val = document.getElementById(el).opac;
		if (typeof val != 'undefined')
			return parseFloat(val);
		else
	    	return 1.0;
	}
	var fade_timer = 0;
	function fade_in_fade_out(el, way)
	{
		var the_op = Math.min(getOpacity(el) + (0.03 * way), 1);
		setOpacity(el, the_op);
		if (way == 1)
		{
			if (the_op < 1)
				fade_timer = setTimeout("fade_in_fade_out('" + el + "', 1)", 50);
			else
				fade_timer = setTimeout("fade_in_fade_out('" + el + "', -1)", 150);
		}
		else
		{
			if (the_op > 0)
				fade_timer = setTimeout("fade_in_fade_out('" + el + "', -1)", 50);
			else
			{
				change_text(el);
				fade_timer = setTimeout("fade_in_fade_out('" + el + "', 1)", 150);
			}
		}
	}
	function stop_fifo(el)
	{
		clearTimeout(fade_timer);
		setOpacity(el, 1);
		fade_timer = 0;
	}
	function change_text(el)
	{
		element = document.getElementById(el);
		element.src = texts[(the_text_ind++) % 2];
	}
	function alg_fata()
	{
		if (are_spate && (sel_parte != "fata"))
		{
			sel_parte = "fata";
			if (!document.getElementById("vreau_logo").checked && (sel_culoare != "unselected") && ((sel_model == "mascul") || (sel_model == "femela") || (sel_model == "extra")))
				document.getElementById("logo_fata").style.display = "block";
			document.getElementById("logo_spate").style.display = "none";
			document.getElementById("fata").style.display = "block";
			document.getElementById("spate").style.display = "none";
			setTimeout( function()
				{
						/*AQUI*/
					var the_src = get_img_src(document.getElementById("tricoul_bg"));
					var the_ext = the_src.substring(the_src.length - 3, the_src.length);
					set_img_src(document.getElementById("tricoul_bg"), the_src.replace("-sp." + the_ext, "." + the_ext));
					//document.getElementById("tricoul_bg").src = document.getElementById("tricoul_bg").src.replace("-sp.png", ".png");
					if (ie_version) 
					{
						var img = document.getElementById("tricoul_bg");
						change_png_image(img);
					}
					var fata = document.getElementById("alege_fata");
					var spate = document.getElementById("alege_spate");
					fata.src = fata.src.replace("_off", "_on");
					spate.src = spate.src.replace("_on", "_off");
				}, 1);
		}
	}
	function alg_spate()
	{
		if (are_spate && (sel_parte != "spate"))
		{
			sel_parte = "spate";
			document.getElementById("logo_fata").style.display = "none";
			if (!document.getElementById("vreau_logo").checked && (sel_culoare != "unselected") && ((sel_model == "mascul") || (sel_model == "femela") || (sel_model == "extra")))
				document.getElementById("logo_spate").style.display = "block";
			document.getElementById("fata").style.display = "none";
			document.getElementById("spate").style.display = "block";
			setTimeout( function()
				{
						/*AQUI*/
					var the_src = get_img_src(document.getElementById("tricoul_bg"));
					var the_ext = the_src.substring(the_src.length - 3, the_src.length);
					set_img_src(document.getElementById("tricoul_bg"), the_src.replace("." + the_ext, "-sp." + the_ext));
					//document.getElementById("tricoul_bg").src = document.getElementById("tricoul_bg").src.replace(".png", "-sp.png");
					if (ie_version) 
					{
						var img = document.getElementById("tricoul_bg");
						change_png_image(img);
					}
					var fata = document.getElementById("alege_fata");
					var spate = document.getElementById("alege_spate");
					fata.src = fata.src.replace("_on", "_off");
					spate.src = spate.src.replace("_off", "_on");
				}, 1);
		}
	}
	function arata_potriviri(arata)
	{
		if (document.getElementById("potriviri").innerHTML.length > 15)
			document.getElementById("potriviri").style.display = ((arata) ? "block" : "none");
	}
	
function footerBook(site)
{
	var rawURL=window.location.href;
	//rawURL=rawURL.replace("#", "");

	var currentURL=encodeURIComponent(rawURL);
	var title=encodeURIComponent(metaTitle);

	var bodytext=encodeURIComponent(metaDescription);

	var newURL;

	switch(site){
		case "del.icio.us":
			newURL = "http://del.icio.us/post?v=4"
			+ ";url=" + currentURL
			+ ";title=" + title;
		break;
		case "digg":
			newURL = "http://digg.com/submit?phase=2&"

			+ "url=" + currentURL

			+ "&title=" + title

			+ "&bodytext=" + bodytext

			+ "&topic=tech_deals";

		break;
		case "reddit":
			newURL = "http://reddit.com/submit?"
			+ "url=" + currentURL
			+ "&title=" + title;
		break;
		case "stumbleupon":
			newURL= "http://www.stumbleupon.com/submit?url=" + currentURL
			+ "&title=" + title;
		break;
		case "facebook":
			newURL = "http://www.facebook.com/share.php?src=bm&v=4"
			+ "&u=" + currentURL
			+ "&t=" + title;
		break;
		case "technorati":
			newURL = "http://technorati.com/faves?sub=favthis&add=" + currentURL;
		break;
		case "google":
			newURL = "http://www.google.com/bookmarks/mark?op=edit&output=popup"
			+ "&bkmk=" + currentURL
			+ "&title=" + title;
		break;
		case "slashdot":
			newURL = "http://slashdot.org/bookmark.pl?url=" + rawURL + "&title=" + title;
		break;
		case "twitter":
			newURL = "http://twitter.com/home?status=" + title + " " + rawURL;
		break;
		case "myspace":
			newURL = "http://www.myspace.com/Modules/PostTo/Pages/?u=" + rawURL + "&t=" + title + "&c=" + rawURL;
		break;
	}

	window.open(newURL, "_blank");
}