function do_template_search(keywords, categoryId, categoryName, templateId)
{
	var targetURL='http://'+location.hostname+'/categorii/';
	if(keywords) targetURL+=escape(keywords.replace(/ /g,'-'))+'/';
	if(categoryId) targetURL+=escape(categoryName.replace(/ /g,'-'))+'/'+categoryId+'/';
	templateId=templateId.replace(/[^0-9]+/,'');
	if(templateId) targetURL+=templateId+'/';
	targetURL+='pagina-1/';
	document.location=targetURL;
}

function do_promo_object_search(keywords, categoryId, categoryName, templateId)
{
	var targetURL='http://'+location.hostname+'/obiecte-personalizate/';
	if(keywords) targetURL+=escape(keywords.replace(/ /g,'-'))+'/';
	if(categoryId) targetURL+=escape(categoryName.replace(/ /g,'-'))+'/'+categoryId+'/';
	if(templateId) targetURL+=templateId+'/';
	targetURL+='pagina-1/';
	document.location=targetURL;
}

function autoResize(frameId){
try{
frame = document.getElementById(frameId);
innerDoc = (frame.contentDocument) ? frame.contentDocument : frame.contentWindow.document;
objToResize = (frame.style) ? frame.style : frame;
objToResize.height = innerDoc.body.scrollHeight + 10;
}
catch(err){
window.status = err.message;
}
}

function validate_email(str) 
{
	var patn=/^[_a-zA-Z0-9\-]+(\.[_a-zA-Z0-9\-]*)*@[a-zA-Z0-9\-]+([\.][a-zA-Z0-9\-]+)+$/;
	if (patn.test(str)) 
	{
		return true;
	}
	return false;
}

function popWin(script,winname,width,height,resizable,scrollbars,menubar,toolbar,status,location) 
{
	strWindowFeatures='';
	if (resizable && (resizable=='yes' || resizable==1)) {
		strWindowFeatures+=',resizable=yes';
	}
	if (scrollbars && (scrollbars=='yes' || scrollbars==1)) {
		strWindowFeatures+=',scrollbars=yes';
	}
	if (menubar && (menubar=='yes' || menubar==1)) {
		strWindowFeatures+=',menubar=yes';
	}
	if (toolbar && (toolbar=='yes' || toolbar==1)) {
		strWindowFeatures+=',toolbar=yes';
	}
	if (status && (status=='yes' || status==1)) {
		strWindowFeatures+=',status=yes';
	}
	if (location && (location=='yes' || location==1)) {
		strWindowFeatures+=',location=yes';
	}
	
	var left=(screen.width-width)/2-60;
	var top=(screen.height-height)/2;
	
	//if (wtop) {
		strWindowFeatures+=',screenX='+top+',top='+top;
	//}
	//if (wleft) {
		strWindowFeatures+=',screenY='+left+',left='+left;
	//}
	
	newPopup = window.open(script,winname,"width="+width+",height="+height+strWindowFeatures);
}

function is_num(str) 
{
	patn=/^[0-9\.]+$/;
	if (patn.test(str)) 
	{
		return true;
	}
	return false;
}