function isLetter(intAscii)
{
 if ((intAscii >= 65 && intAscii <= 90) || (intAscii >= 97 && intAscii <= 122)) return true; else return false;
}

function isNumber(intAscii)
{
 if (intAscii >= 48 && intAscii <= 58) return true; else return false;
}

function isSpecialChar(intAscii)
{
 if (intAscii == 32) return true; else return false;
}

function cleanSk(strCad)
{
 var i, intAscii, strRetVal;
 strRetVal = '';
 for (i = 0; i < strCad.length; i++)
 {
  intAscii = strCad.charCodeAt(i);
  if (isLetter(intAscii) || isNumber(intAscii) || isSpecialChar(intAscii)) strRetVal += strCad.substring(i, i + 1);
 }
 return strRetVal;
}

function checkSearch()
{
 if (document.getElementById('searchForm').sk.value != '')
 {
  document.getElementById('searchForm').sk.value = cleanSk(document.getElementById('searchForm').sk.value);
  if (document.getElementById('searchForm').sk.value != '')
  {
   location.href = 'http://www.tribalshapes.com/search.php?sk='+document.search.sk.value;
   return false;
  }
  else
  {
   alert('Error! You must complete the field correctly!');
   document.getElementById('searchForm').sk.focus();
   return false;
  }
 }
 else
 {
  alert('Error! You must complete the field correctly!');
  document.getElementById('searchForm').sk.focus();
  return false;
 }
}

function checkEmail(strEmail)
{
 if (strEmail.length >= 5 && strEmail.indexOf('@') != -1 && strEmail.indexOf('.') != -1)
 {
  var atpos = strEmail.indexOf('@')
  var dotpos = strEmail.indexOf('.', atpos)
  var user = strEmail.substring(0, atpos)
  var domname = strEmail.substring(atpos + 1, dotpos)
  var domlast = strEmail.substring(dotpos + 1)
  if (user.length > 0 && domname.length > 0 && domlast.length > 0)
  {
   return true;
  }
  else
  {
   return false;
  }
 }
 else
 {
  return false;
 }
}

function checkContact()
{
 if (document.getElementById('contactForm').message.value == '')
 {
  alert('Error! You must write down a message!');
  document.getElementById('contactForm').message.focus();
  return false;
 }
 else
 {
  return true;
 }
}

function checkKanjiRequest()
{
 if (document.getElementById('kanjiRequestForm').request.value == '')
 {
  alert('Error! You must write down a request message!');
  document.getElementById('kanjiRequestForm').request.focus();
  return false;
 }
 else
 {
  return true;
 }
}

function checkSendByEmail()
{
 if (document.getElementById('sendbyemailform').yourname.value == '')
 {
  alert('Error! You must input your name!');
  document.getElementById('sendbyemailform').yourname.focus();
  return false;
 }
 else
 {
  if (!checkEmail(document.getElementById('sendbyemailform').youremail.value))
  {
   alert('Error! Your email is not valid!');
   document.getElementById('sendbyemailform').youremail.focus();
   return false;
  }
  else
  {
   if (document.getElementById('sendbyemailform').friendname.value == '')
   {
    alert('Error! You must input your friend\'s name!');
    document.getElementById('sendbyemailform').friendname.focus();
    return false;
   }
   else
   {
    if (!checkEmail(document.getElementById('sendbyemailform').friendemail.value))
    {
     alert('Error! Your friend\'s email is not valid!');
     document.getElementById('sendbyemailform').friendemail.focus();
     return false;
    }
    else
    {
     return true;
    }
   }
  }
 }
}

function checkSubmitFlash()
{
 if (document.getElementById('submitFlashForm').name.value == '')
 {
  alert('Error! You must input your name!');
  document.getElementById('submitFlashForm').name.focus();
  return false;
 }
 else
 {
  if (!checkEmail(document.getElementById('submitFlashForm').email.value))
  {
   alert('Error! Your email is not valid!');
   document.getElementById('submitFlashForm').email.focus();
   return false;
  }
  else
  {
   if (document.getElementById('submitFlashForm').image.value == '')
   {
    alert('Error! You must input a file!');
    document.getElementById('submitFlashForm').image.focus();
    return false;
   }
   else
   {
    return true;
   }
  }
 }
}

function browserBookmark(url, title)
{
 if (window.sidebar) window.sidebar.addPanel(title, url, '');
   else if(window.external) window.external.AddFavorite(url, title);
     else if(window.opera && window.print) return true;
 return false;
}

function printerFriendlyTattoo(textid, cat, width, height)
{
 width += 50;
 if (height + 125 < screen.height - 140) height += 125; else height = screen.height - 140;
 var top = (screen.height - height - 80) / 2;
 var left = (screen.width - width) / 2;
 window.open('http://www.tribalshapes.com/printerfriendlytattoo.php?textid='+textid+'&cat='+cat, 'printerFriendlyTattoo', 'menubar=no,location=no,resizable=no,scrollbars=yes,status=no,width='+width+',height='+height+',top='+top+',left='+left);
}

function showMenu()
{
 document.getElementById('mainmenucontent').style.width = '10.2em';
 document.getElementById('mainmenu').style.marginLeft = '32.65em';
}

function hideMenu()
{
 document.getElementById('mainmenucontent').style.width = '0';
 document.getElementById('mainmenu').style.marginLeft = '42.85em';
}

function overMainMenuOption(objElement)
{
 objElement.style.borderColor = '#DEEFFA';
 objElement.style.backgroundColor = '#CEDFEA';
}

function outMainMenuOption(objElement)
{
 objElement.style.borderColor = '#BECFDA';
 objElement.style.backgroundColor = '#BECFDA';
}

function showBookmarksMenu()
{
 document.getElementById('bookmarksmenucontent').style.height = '2em';
 document.getElementById('bookmarksmenucontent').style.borderWidth = '0 0.06em 0.06em';
 document.getElementById('bookmarksmenucontent').style.padding = '0.6em 0.5em';
}

function hideBookmarksMenu()
{
 document.getElementById('bookmarksmenucontent').style.height = '0';
 document.getElementById('bookmarksmenucontent').style.borderWidth = '0';
 document.getElementById('bookmarksmenucontent').style.padding = '0';
}

function bookmarkClick(strId)
{
 document.getElementById('bookmarksform').id.value = strId;
 document.getElementById('bookmarksform').submit();
 return false;
}

function showAggregatorsMenu()
{
 document.getElementById('aggregatorsmenucontent').style.height = '1.4em';
 document.getElementById('aggregatorsmenucontent').style.borderWidth = '0 0.06em 0.06em';
 document.getElementById('aggregatorsmenucontent').style.padding = '0.6em 0.5em';
}

function hideAggregatorsMenu()
{
 document.getElementById('aggregatorsmenucontent').style.height = '0';
 document.getElementById('aggregatorsmenucontent').style.borderWidth = '0';
 document.getElementById('aggregatorsmenucontent').style.padding = '0';
}

function aggregatorClick(strId)
{
 document.getElementById('aggregatorsform').id.value = strId;
 document.getElementById('aggregatorsform').submit();
 return false;
}

function bannerClick()
{
 location.href = 'http://www.virtuallyinked.com/affiliates/jrox.php?id=17426_1_bid_9';
 return false;
}