function validate_required(field,alerttxt)
{
with (field)
{
if (value==null||value=="")
  {return false;}
else {return true}
}
}


function validate_email(field,alerttxt)
{
with (field)
{
apos=value.indexOf("@");
dotpos=value.lastIndexOf(".");
if (apos<1||dotpos-apos<2)
  {return false;}
else {return true;}
}
}

function validate_form(thisform)
{
with (thisform)
{
var txterr="Моля, проверете подчертаните полета";
var err=0;
if (validate_email(sendermail,"Not a valid e-mail address!")==false){
   var err=1;
   sendermail.style.borderColor="red";
}else{
   sendermail.style.borderColor="black";
}

if (validate_required(sendername,"Not a valid name address!")==false){
    var err=1;
    sendername.style.borderColor="red";
}else{
   sendername.style.borderColor="black";
}



if (validate_email(recmail,"Not a valid e-mail address!")==false){
    var err=1;
    recmail.style.borderColor="red";
}else{
    recmail.style.borderColor="black";
}

if (validate_required(recname,"Not a valid name address!")==false){
    var err=1;
    recname.style.borderColor="red";
}else{
     recname.style.borderColor="black";
}
if(err==1)
 {alert(txterr); return false;}

}
}


function changeBGC(color){
document.getElementById("cardholder").style.backgroundColor = color;
document.getElementById("s1").style.backgroundColor = color;
document.getElementById("s2").style.backgroundColor = color;
document.getElementById("s3").style.backgroundColor = color;

 document.getElementById("backcolor").value = color;
}

function changeFC(color){
document.getElementById("cardholder").style.color = color;
document.getElementById("s1").style.color = color;
document.getElementById("s2").style.color = color;
document.getElementById("s3").style.color = color;
document.getElementById("txtcolor").value = color;

}