// JavaScript Document
function showHide(el)
{
    if (document.getElementById(el).style.display == "block")
    {
        document.getElementById(el).style.display = "none";
    }
    else
    {
        document.getElementById(el).style.display = "block";
    }
}

function showHideMain()
{
  document.getElementById('cc-log').style.display = "none";
  document.getElementById('cc-reg').style.display = "block";
}

function trim(str, chars) {
    return ltrim(rtrim(str, chars), chars);
}

function ltrim(str, chars) {
    chars = chars || "\\s";
    return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}

function rtrim(str, chars) {
    chars = chars || "\\s";
    return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}
function isValidEmail(str) {

   return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
}
function pp(sPicURL) {
  window.open( sPicURL, "",  "resizable=1,HEIGHT=260,WIDTH=320");
}

function showTalent(sPicURL) {
  var my = window.open( sPicURL, "",  "resizable=1,HEIGHT=400,WIDTH=480,scrollbars=1");
  my.moveTo(250, 100);
}

function shotPhtoto(sPicURL) {
     var my = window.open( "/img.html?"+sPicURL, "",  "resizable=1,HEIGHT=200,WIDTH=200");
	 my.moveTo(250, 100);
}

function isValidEmail(str) {

   return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
}

function checkform()
{
    if (document.forms["reg"].elements["login"].value == "" || document.forms["reg"].elements["email"].value == "" || document.forms["reg"].elements["name"].value == "" || document.forms["reg"].elements["password"].value == "")
    {
        alert("Fill in all fields! / Заполните все поля!");
        return false;
    }
    
	if (document.forms["reg"].elements["login"].value.length < 3 || document.forms["reg"].elements["email"].value.length < 3 || document.forms["reg"].elements["name"].value.length < 3 || document.forms["reg"].elements["password"].value.length < 3)
	{
		alert("Fill in all fields! / Заполните все поля!");
        return false;
	}
	
    if (!isValidEmail(document.forms["reg"].elements["email"].value))
    {
        alert("Wrong Email!");
        return false;
    }
    
    return true;
}


