function searchForTutorials(lang)
{
	var searchForm = document.getElementById("search").value;

//	if ((searchForm=="") || (searchForm==stringToCompare))
//	{
//		alert(errorMsg);
//		document.getElementById("searchForm").focus();
//		document.getElementById("searchForm").value="";
//		return false;
//	}
	
	searchForm = searchForm.replace(/ /gi, '+');
	
	if (lang=="en")
		document.location = 'http://tutorials.u-trade.org/search/page_1/'+searchForm;
	else
		document.location = 'http://tutoriale.u-trade.ro/cautare/pagina_1/'+searchForm;
}

function postComment(errName, errComment, successComment, failedComment, tutorialsLoc, tutorialID, request_uri)
{
	if (document.getElementById("numeComment").value=="")
	{
		alert(errName+" !");
		document.getElementById("numeComment").focus();
		return false;
	}
	if (document.getElementById("contentComment").value=="")
	{
		alert(errComment+" !");
		document.getElementById("numeComment").focus();
		return false;
	}

	var numeComment = document.getElementById('numeComment').value;
	var contentComment = document.getElementById('contentComment').value;


	var targetURL =  tutorialsLoc+"ajax/post_comment.php";
	targetURL += "?numecomment="+numeComment;
	targetURL += "&contentcomment="+contentComment;
	targetURL += "&contentarea=tutorials";
	targetURL += "&contentid="+tutorialID;
	targetURL += "&contentURL="+request_uri;
	targetURL += "&mesaj="+successComment;
	targetURL += "&mesaj_error="+failedComment;

	showHint_ultimate(targetURL, "containerStatus")
	document.getElementById('commentPlace').style.display='none';
	document.getElementById('post_comment_link').style.display='';
	contentToAdd = '<div class="titleComment" style="width:566px;">'+numeComment+'</div><div class="contentComment" style="width:566px;" align="left">'+contentComment+'</div><br />';
	document.getElementById("existingComments").innerHTML = contentToAdd + document.getElementById("existingComments").innerHTML;
	document.getElementById('numeComment').value = "";
	document.getElementById('contentComment').value = "";
}

function loadSmyle(code_smile)
{
	browser = navigator.userAgent.toLowerCase();
	
	if (browser.indexOf('firefox') != -1)
	{
		selStart   = document.getElementById("contentComment").selectionStart;
		selEnd     = document.getElementById("contentComment").selectionEnd;
		allContent = document.getElementById("contentComment").value;
		selBefore  = allContent.substring(0, selStart);
		selAfter   = allContent.substring(selEnd, allContent.length);
	
		document.getElementById("contentComment").value = selBefore+code_smile+selAfter
	}
	
	if (browser.indexOf('msie') != -1)
	{
		alert("We are sorry but this function is disabled in Internet Explorer or similar due to of some existing bugs found. You may still insert smilyes using codes from image title.")
	}
}

function checkLogin(msg)
{
	var usr  = document.getElementById("userForm").value;
	var pass = document.getElementById("passwordForm").value;
	if ((usr=="username") || (pass=="password") || (usr=="utilizator") || (pass=="parola") || (usr=="") || (pass==""))
	{
		alert(msg);
		return false;
	}
}
function verificaForm(component, reWriteContent, mod)
{
	actualContent = document.getElementById(component).value;

	if (mod == "focus")
	{
		if (actualContent == reWriteContent)
			document.getElementById(component).value = "";
	}
	if (mod == "blur")
	{
		if (actualContent == "")
			document.getElementById(component).value = reWriteContent;
	}
}

function verifyRequest(errEmptyEmail, errEmptyRequest, errIncorectEmail)
{
	email = document.getElementById("email")
	request = document.getElementById("request")
	if (email.value=="")
	{
		alert(errEmptyEmail+" !")
		email.focus();
		return false;
	}
	if (request.value=="")
	{
		alert(errEmptyRequest+" !")
		request.focus();
		return false;
	}
	
	sir = email.value;
	tmp = sir.indexOf("@", 1);
	tmp2 = sir.indexOf(".", 1);
	if (tmp == -1)
	{
		alert(errIncorectEmail)
		document.getElementById("email").focus();
		return false;
	}
	if (tmp2 == -1)
	{
		alert(errIncorectEmail)
		document.getElementById("email").focus();
		return false;
	}
}

function sendTo(destination)
{
	var trgt = "";
	switch (destination)
	{
		case "dreamweaver":
			trgt = 'https://www.adobe.com/cfusion/tdrc/index.cfm?product=dreamweaver&amp;loc=en_us';
		break;
		case "visual_studio":
			trgt = 'http://www.microsoft.com/express/Default.aspx';
		break;
		case "photoshop":
			trgt = 'https://www.adobe.com/cfusion/tdrc/index.cfm?product=photoshop&loc=en';
		break;
		case "flash":
			trgt = 'https://www.adobe.com/cfusion/tdrc/index.cfm?product=flashpro';
		break;
		case "3dsmax":
			trgt = 'http://usa.autodesk.com/adsk/servlet/pc/index?siteID=123112&id=13571450';
		break;
		case "validator_w3c_html":
			trgt = 'http://validator.w3.org/';
		break;
		case "validator_w3c_css":
			trgt = 'http://jigsaw.w3.org/css-validator/#validate-by-uri';
		break;
		case "validator_w3c_rss":
			trgt = 'http://validator.w3.org/feed/';
		break;
		case "url_validator":
			trgt = 'http://validator.w3.org/checklink';
		break;
		case "semantic_validator":
			trgt = 'http://www.w3.org/2003/12/semantic-extractor.html';
		break;
		case "rdf_validator":
			trgt = 'http://www.w3.org/RDF/Validator/';
		break;
		case "p3p_validator":
			trgt = 'http://www.w3.org/P3P/validator.html';
		break;
		case "xml_validator":
			trgt = 'http://www.w3.org/2001/03/webdata/xsv';
		break;
	}
	window.open(trgt)
}