function vote(grade,prod_id,base_url)
{
	$.get(base_url+"vote.php?prod_id="+prod_id+"&grade="+grade, function(data){
		  if(data) alert(data);
		});
}
function copySelectedEmails()
{
	var emails=[];
	var index=0;
	$("input[name=checkall\\[\\]]").each(function()
	{
		if(this.checked && this.value)
		{
			var found=false;
			for(i=0;i<emails.length;i++)
				if(this.value==emails[i])
				{
					found=true;
					break;
				}
			if(!found) 
			{
				emails[index]=this.value;
				index++;
			}
			
		}
	});	
	str='';
	for(i=0;i<emails.length;i++)
	{
		str+=emails[i];
		if(i!=emails.length-1) str+=', ';
	}
	document.getElementById('clipboard').value=emails;
	document.getElementById('clipboard').style.display='block';
}

function copySelectedEmails2()
{
	var emails=[];
	var index=0;
	$("input[name=checkall\\[\\]]").each(function()
	{
		if(this.checked && $(this).attr("rel"))
		{
			var found=false;
			for(i=0;i<emails.length;i++)
				if($(this).attr("rel")==emails[i])
				{
					found=true;
					break;
				}
			if(!found) 
			{
				emails[index]=$(this).attr("rel");
				index++;
			}
			
		}
	});	
	str='';
	for(i=0;i<emails.length;i++)
	{
		str+=emails[i];
		if(i!=emails.length-1) str+=', ';
	}
	document.getElementById('clipboard').value=emails;
	document.getElementById('clipboard').style.display='block';
}function isEmail(str) {	return str.match(/^[a-z0-9_\.-]+@[a-z0-9\.-]+\.[a-z]{2,4}$/i);}

function scripts() {
	// Search
	var el = $('#filter_keyword');
	
	if (el.val() != el.attr('title')) {
		el.css('font-weight', 'normal');
		el.css('color', '#000');
	}
	
	el.focus(function() {
		if ($(this).val() == $(this).attr('title')) {
			$(this).val('');
			$(this).css('font-weight', 'normal');
			$(this).css('color', '#000');
		}
	});
	
	el.blur(function() {
		if ($(this).val() == '') {
			$(this).val($(this).attr('title'));
			$(this).css('font-weight', 'bold');
			$(this).css('color', 'red');
		}
	});
	
	// Expandable categories
	
	var list = $('.catalog li');
	var to;
	
	list.mouseover(function(e) {
		elem = $(this).find('a:eq(0)');
		id = elem.attr('id').split('_')[1];
		expand = elem.parent().find('#expand_' + id);
		
		$('.expand').removeClass('sel');
		expand.find('.expand').addClass('sel');
		$('.expand:not(.sel)').css({ display: 'none' });
		clearTimeout(to);
		expand.css({ display: 'block' });
	}).mouseout(function() {
		elem = $(this).find('a:eq(0)');
		id = elem.attr('id').split('_')[1];
		expand = elem.parent().find('#expand_' + id);
		
		clearTimeout(to);
		to = setTimeout(function() {
			expand.css({ display: 'none' });
		}, 3000);
	});
	
	//*/
}

$(document).ready(scripts);


