function Compter(Target, max, nomchamp)
{
	StrLen = Target.value.length
	if (StrLen > max )
	{
	  Target.value = Target.value.substring(0,max);
	  CharsLeft = max;
	} else {
	  CharsLeft = StrLen;
	}
	nomchamp.value = max - CharsLeft;
}

function frmsubmit(func) {
	frm = document.getElementById("caddieform");
	frm.func.value = func;
	frm.submit();
}

function switch_product_images(new_main, new_main_zoom, vignette_id){
	var current_main = document.getElementById('mainProductImage').src;
	var current_main_zoom = document.getElementById('zoom1').href;
	document.getElementById(vignette_id).innerHTML = '<a href="javascript:switch_product_images(\''+current_main+'\', \''+current_main_zoom+'\', \''+vignette_id+'\')"><img src="'+current_main+'" name="'+vignette_id+'" width="50" border="0" /></a>';
	document.getElementById('mainProductImage').src = new_main;
	document.getElementById('zoom1').href = new_main_zoom;
}
function switch_product_tab(tab_to_highlight_id,title_to_highlight_id){
	var current_tab=document.getElementById('current_tab_id').value;
	var current_tab_title=document.getElementById('current_tab_title').value;


	document.getElementById(current_tab).style.display='none';
	document.getElementById(current_tab_title).className='tab';

	document.getElementById(tab_to_highlight_id).style.display='block';
	document.getElementById(title_to_highlight_id).className='current_tab';

	document.getElementById('current_tab_id').value=tab_to_highlight_id;
	document.getElementById('current_tab_title').value=title_to_highlight_id;
}

function popupSmileys (src) {
	window.open(src,'', 'top=20, left=20, width=220, height=360, resizable=yes, toolbar=no, scrollbars=yes, status=yes');
}
