function externalLinks() { 
 if(!document.getElementsByTagName) return; 
 var anchors = document.getElementsByTagName("a"); 
 for(var i=0; i<anchors.length; i++)
 { 
  var anchor = anchors[i]; 
  if(anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") 
   anchor.target = "_blank"; 
 } 
} 
window.onload = externalLinks;

window.defaultStatus = "www.Techno-Topliste.de - Die Topliste für alle Techno Seiten";

function CheckLen()
{
 StrLen = document.getElementById("nachricht").value.length;
 if (StrLen > 250) 
 {
  document.getElementById("nachricht").value = document.getElementById("nachricht").value.substring(0,250);
  CharsLeft = 0; 
 }
 else
 {
  CharsLeft = 250 - StrLen; 
 }
 document.getElementById("anzahl").value = CharsLeft; 
}
function checkname()
{
 if((document.getElementById("name").value.length < 3) || (document.getElementById("name").value.length >= 61) || (document.getElementById("name").value == "") || (document.getElementById("name").value == "Seitenname"))
 {
  document.getElementById("div_name").className = "incorrect";
  document.getElementById("img_name").className = "incorrect";
 }
 else
 {
  document.getElementById("div_name").className = "correct";
  document.getElementById("img_name").className = "correct";
 }
}
function checktext()
{
 if((document.getElementById("nachricht").value.length < 3) || (document.getElementById("nachricht").value.length >= 61) || (document.getElementById("nachricht").value == ""))
 {
  document.getElementById("div_text").className = "incorrect";
  document.getElementById("img_text").className = "incorrect";
 }
 else
 {
  document.getElementById("div_text").className = "correct";
  document.getElementById("img_text").className = "correct";
 }
}
function EMail(s)
{
 var res = false;
 reg = new RegExp('^([a-zA-Z0-9]([a-zA-Z0-9äüöÄÜÖ\\.\\_\\-]+))'+'(\\@)([a-zA-Z0-9][a-zA-Z0-9äüöÄÜÖ\\-]+)'+'((\\.)([a-zA-Z]{2,4})){1,2}$');
 res = (reg.test(s));
 return(res);
}
function checkemail()
{
 if(EMail(document.getElementById("email").value) == true)
 {
  document.getElementById("div_email").className = "correct";
  document.getElementById("img_email").className = "correct";
 }
 else
 {
  document.getElementById("div_email").className = "incorrect";
  document.getElementById("img_email").className = "incorrect";
 }
}
function CHURL(s)
{
 var res = false;
 reg = new RegExp('^((www.){0,1})'+'([a-zA-Z0-9]([a-zA-Z0-9äüöÄÜÖ\\-]{2,99}))'+'((\\.)([a-zA-Z]{2,4})){1,2}[\\/:]{0,1}([0-9a-zA-zäöüÄÖÜ\\+\\-\\.\\°\\^\\!\\§\\$\\%\\&\\(\\)\\=\\_\\~\\,\\;\\:\\#\\@\\/]{0,999})$');
 res = (reg.test(s));
 return(res);
}
function checkurl()
{
 if(CHURL(document.getElementById("url").value) == true)
 {
  document.getElementById("div_url").className = "correct";
  document.getElementById("img_url").className = "correct";
 }
 else
 {
  document.getElementById("div_url").className = "incorrect";
  document.getElementById("img_url").className = "incorrect";
 }
}
function BANNER(s)
{
 var res = false;
 reg = new RegExp('^((www.){0,1})'+'([a-zA-Z0-9]([a-zA-Z0-9äüöÄÜÖ\\-]{2,99})'+'((\\.)([a-zA-Z]{2,4})){1,2}[\\/]{0,1}([0-9a-zA-ZäöüÄÖÜ\\+\\-\\.\\°\\^\\!\\_\\§\\$\\%\\&\\(\\)\\=\\~\\,\\;\\:\\#\\@\\/]+)[\\.]{1}(JPG|jpg|PNG|png|GIF|gif|JPEG|jpeg|BMP|bmp))$');
 res = (reg.test(s));
 return(res);
}
function checkbanner()
{
 if(BANNER(document.getElementById("banner").value) == true || (document.getElementById("banner").value == ""))
 {
  document.getElementById("div_banner").className = "correct";
  document.getElementById("img_banner").className = "correct";
 }
 else
 {
  document.getElementById("div_banner").className = "incorrect";
  document.getElementById("img_banner").className = "incorrect";
 }
}
function PASSWORT(s)
{
 var res = false;
 reg = new RegExp('^[0-9a-zA-ZäöüÄÖÜ\\+\\-\\.\\°\\^\\!\\§\\$\\%\\&\\(\\)\\=\\~\\,\\;\\:\\#\\@\\/\\=\\?\\§\\*]{3,20}$');
 res = (reg.test(s));
 return res;
}
function checkpw()
{
 if((document.getElementById("passwort").value.length < 3) || (document.getElementById("passwort").value.length >= 21) || (document.getElementById("passwort").value == "") || (document.getElementById("name").value == "Passwort") || (PASSWORT(document.getElementById("passwort").value) == false))
 {
  document.getElementById("div_passwort").className = "incorrect";
  document.getElementById("img_passwort").className = "incorrect";
 }
 else
 {
  document.getElementById("div_passwort").className = "correct";
  document.getElementById("img_passwort").className = "correct";
 }
}
function checkformat()
{
 if((document.getElementById("bmail").value != 1) || (document.getElementById("bmail").value != 2))
 {
  document.getElementById("div_format").className = "correct";
  document.getElementById("img_format").className = "correct";
 }
 else
 {
  document.getElementById("div_format").className = "incorrect";
  document.getElementById("img_format").className = "incorrect";
 }
}
function checkherkunft()
{
 if((document.getElementById("herkunft").value != 1) || (document.getElementById("herkunft").value != 2) || (document.getElementById("herkunft").value != 3) || (document.getElementById("herkunft").value != 0))
 {
  document.getElementById("div_herkunft").className = "correct";
  document.getElementById("img_herkunft").className = "correct";
 }
 else
 {
  document.getElementById("div_herkunft").className = "incorrect";
  document.getElementById("img_herkunft").className = "incorrect";
 }
}
function checkstyle()
{
 if((document.getElementById("style").value.length < 3) || (document.getElementById("style").value.length >= 51) || (document.getElementById("style").value == "") || (document.getElementById("style").value == "Style"))
 {
  document.getElementById("div_style").className = "incorrect";
  document.getElementById("img_style").className = "incorrect";
 }
 else
 {
  document.getElementById("div_style").className = "correct";
  document.getElementById("img_style").className = "correct";
 }
}
function checkphono(FeldID)
{
 var res = false;
 reg = new RegExp('^((psradio\\:\\/\\/\\|ChannelId\\|){1}[0-9]{1,14})$');
 res = (reg.test(document.getElementById(FeldID).value));

 if((res == true) || (document.getElementById(FeldID).value == "") || (document.getElementById(FeldID).value == "URL zu Ihrem Phonostar Player Stream"))
 {
  document.getElementById("div_" + FeldID).className = "correct";
  document.getElementById("img_" + FeldID).className = "correct";
 }
 else
 {
  document.getElementById("div_" + FeldID).className = "incorrect";
  document.getElementById("img_" + FeldID).className = "incorrect";
 }
}
function stream(s)
{
 var res = false;
 reg = new RegExp('^((www.){0,1})'+'([a-zA-Z0-9]([a-zA-Z0-9äüöÄÜÖ\\-]{2,99}))'+'((\\.)([a-zA-Z]{2,4})){1,2}[\\/:]{1}([0-9a-zA-zäöüÄÖÜ\\+\\-\\.\\°\\^\\!\\§\\$\\%\\&\\(\\)\\=\\_\\~\\,\\;\\:\\#\\@\\/]{0,999})$');
 res = (reg.test(s));
 return(res);
}
function stream2(s)
{
 var res = false;
 reg = new RegExp('^([0-9]{1,3}'+'(\\.)[0-9]{1,3}'+'(\\.)[0-9]{1,3}'+'(\\.)[0-9]{1,3}[\\/\\:]{1}([0-9a-zA-zäöüÄÖÜ\\+\\-\\.\\°\\^\\!\\§\\$\\%\\&\\(\\)\\=\\_\\~\\,\\;\\:\\#\\@\\/]{0,999}))$');
 res = (reg.test(s));
 return(res);
}
function checkstream(FeldID)
{
 if(stream(document.getElementById(FeldID).value) == true || stream2(document.getElementById(FeldID).value) == true || document.getElementById(FeldID).value == "")
 {
  document.getElementById("div_" + FeldID).className = "correct";
  document.getElementById("img_" + FeldID).className = "correct";
 }
 else
 {
  document.getElementById("div_" + FeldID).className = "incorrect";
  document.getElementById("img_" + FeldID).className = "incorrect";
 }
}
function TextKopieren(FeldID)
{
 document.getElementById(FeldID).focus();
 document.getElementById(FeldID).select();
 if(document.all)
 {
  Bereich = document.getElementById(FeldID).createTextRange();
  Bereich.execCommand("Copy");
 }
}
function checknewpw(FeldID)
{
 if((document.getElementById(FeldID).value.length < 3) || (document.getElementById(FeldID).value.length >= 21) || (document.getElementById(FeldID).value == "") || (PASSWORT(document.getElementById(FeldID).value) == false))
 {
  document.getElementById("div_pw" + FeldID).className = "incorrect";
  document.getElementById("img_pw" + FeldID).className = "incorrect";
 }
 else
 {
  document.getElementById("div_pw" + FeldID).className = "correct";
  document.getElementById("img_pw" + FeldID).className = "correct";
 }
}
function out(username)
{
 image = new Image();
 image.src= 'http://www.techno-topliste.de/out-' + username + '.html';
}
function checkcommentname()
{
 if((document.getElementById("name").value.length < 3) || (document.getElementById("name").value.length >= 21) || (document.getElementById("name").value == "") || (document.getElementById("name").value == "Ihr Name"))
 {
  document.getElementById("div_name").className = "incorrect";
  document.getElementById("img_name").className = "incorrect";
 }
 else
 {
  document.getElementById("div_name").className = "correct";
  document.getElementById("img_name").className = "correct";
 }
}
function checkcode()
{
 if((document.getElementById("captchacode").value.length != 5) || (document.getElementById("captchacode").value == "Code"))
 {
  document.getElementById("div_code").className = "incorrect";
  document.getElementById("img_code").className = "incorrect";
 }
 else
 {
  document.getElementById("div_code").className = "correct";
  document.getElementById("img_code").className = "correct";
 }
}
