

/*
 *File Name     : script.js
 *Version       : 01
 *Date          : 08/04/2003(dd/mm/yy)
 *Author        : Supriya Simhadri
 *Synopsis      :
 *Description   : This script file contains all the basic javascript functions
 *See Also      :
 *Changes(if any):              Date:           Changed By:

*/
// function to check the date
function gtdate(d,m,y)
{
	if ((isNaN(d)) || (isNaN(m)) || (isNaN(y)))
    {
    return false;
	}
	if ((d.indexOf('+')!=-1) || (m.indexOf('+')!=-1) || (y.indexOf('+')!=-1))
	{
	return false;
	}
	if ((d.indexOf('-')!=-1) || (m.indexOf('-')!=-1) || (y.indexOf('-')!=-1))
	{
	return false;
	}

var today= new Date();
var cyear=today.getFullYear();
if((d>31) || (m>12) || (y>cyear)|| (y.length!=4))
   {return false; }
 if (m=="2" || m=="02" )
    {
     if (d>29)
       {
           //  alert("Invalid Date! February cannot have more than 29 days");
           return false;
       }
     if ((y%4)!==0)
       { if (d>=29)
         {
           return false;
	 }
       }
    }
 else if (d==31)
   {
      switch (m)
       {
            case "4":
            case "04":
              return false;
            case "6":
            case "06":
               return false;
            case "9":
            case "09":
                return false;
            case 11:
                 return false;
       }
	}
      return true;
}
//end of function

//function to checks for the valid email
function isValidEmaill(formName, fieldName,flag){
      var email=document.forms[formName].elements[fieldName].value;
      var at='@'
		var dot='.'
		var lat=email.indexOf('.')
		var lstr=email.length
		var ldot=email.indexOf('.')
      if(flag==true && email==0){
	  return isMandatory(formName,fieldName);
      }
      
      
      if((flag==false && email!=0)||flag==true){
	 	  if(!((email.indexOf(' ')<0)&&(email.indexOf('@')>0)&&(email.indexOf('.')>0)&&(email.lastIndexOf('.')>4)
			    && (email.indexOf('@',email.indexOf('@')+1)==-1)
			    && (email.substring(email.indexOf('@')-1,email.indexOf('@'))!=".")
			     && (email.substring(email.indexOf('@')+1,email.indexOf('@')+2)!=".")			    
			    && (email.lastIndexOf('.')>(email.indexOf('@')+2))
			     && (email.indexOf('.',(email.indexOf('@')+2))!=-1)
			     && (email.substring(lstr-1,lstr)!="@")			   
			     && (email.substring(lstr-1,lstr)!=".")	
			     &&(email.indexOf('.')!=-1 || email.indexOf('.')!=0 || email.substring(lstr-1,lstr)!="." )
			     && (email.indexOf('\'')==-1))){
			    
	      window.alert(" Eingabe Email Adresse notwendig! ");
	      document.forms[formName].elements[fieldName].focus();
	      document.forms[formName].elements[fieldName].select();
	      return false;
	      
	  }
      }
      return true;
}
 //function to  check for mandatory fields
function isMandatory(formName, fieldName){
	var val=0;			//comment why the variable is used
	dname=window.document.forms[formName].elements[fieldName].title;
	var newname='';
	if(document.forms[formName].elements[fieldName].type=='select-one'){
	
	    val=document.forms[formName].elements[fieldName].
		   options[document.forms[formName].elements[fieldName].
		   selectedIndex].value;
	} else {
	    val=document.forms[formName].elements[fieldName].value;
	}
	if(val==0){
	    alert(" Eingabe "+dname+" notwendig! ");
	    document.forms[formName].elements[fieldName].focus();
		return false;	//when this will happen
	} else{
	   return true;
	}
}
//end isMandatory
// function to trim the string
function Trim(oldStr){
        var start=0;
        var count=0;
        var newStr="";
        for(cnt=0;cnt<oldStr.length;cnt++) {
                if((start==1)&&(oldStr.charAt(cnt)==" ")) {
                        count++;
                        continue;
                }
                if(count>=1)
                newStr+=" ";
                if(oldStr.charAt(cnt)!=" ") {
                        start=1;
                        newStr+=oldStr.charAt(cnt);
                        count=0;
                }
        }
        return newStr;
}// end Trim
function isAmount(formName,fieldName)
{
 
 var amt = document.forms[formName].elements[fieldName].value;
 if (amt.length==0)
 {
    return true;
 }

 if (amt.indexOf(",")<0)
 {
  alert('Ungültige Amount Data');
  return false;
 }
 amt = amt.replace(',','')
 if(isNaN(amt))
 {
  alert('Ungültige Amount Data');
  return false;
 }

  return true;
}
function isNumber(formName,fieldName,flag)
{
		if(flag==true && document.forms[formName].elements[fieldName].value==0)
		{
			return isMandatory(formName,fieldName);
		}
		if(Trim(document.forms[formName].elements[fieldName].value).length!=0)
		{
			var numb= document.forms[formName].elements[fieldName].value;
			for(var len=0;len<numb.length;len++)
			{

				if(isNaN(numb.charAt(len)>=0 && numb.charAt(len)<=9)|| numb.charAt(len)==".")
				{
				}
				else
				{
				  alert('Ungültige Zeichen eingegeben in');
			//document.forms[formName].elements[fieldName].focus();
		  //document.forms[formName].elements[fieldName].select();
		                  return false;
				}
			}
		}
			trimField(formName,fieldName);
			return true;
}//end isNum
//function to  check the value for numeric
 function isNum(formName,fieldName)
 {
  if(Trim(document.forms[formName].elements[fieldName].value).length!=0)
   {
     var numb= document.forms[formName].elements[fieldName].value;
     for(var len=0;len<numb.length;len++)
      {

	if((!(numb.charAt(len)>=0 && numb.charAt(len)<=9)) || (numb.charAt(len)==" "))
        {
         return false;
        }
      }
   }
  return true;
 }//end isNum

//function to  check the value for numeric
 function isNumQty(formName,fieldName)
 {
  if(Trim(document.forms[formName].elements[fieldName].value).length!=0)
   {
     var numb=document.forms[formName].elements[fieldName].value;
     for(var len=0;len<numb.length;len++)
      {
       if(!(numb.charAt(len)>=0 && numb.charAt(len)<=9))
        {
         alert('Ungültige Zeichen eingegeben in');
         document.forms[formName].elements[fieldName].focus();
         return false;
        }
      }
   }
  return true;
 }//end isNum

function callPrdDetails(domain,colname, colval, catdesc)
{
//1 apr_title
//2 apr_artist
//3 apr_composer
//4 apr_company
//5 apr_phononet
//0 Überschrift

//6 apr_lable
//7 kpr_title
//8 kpr_author
//9 kpr_Description
//10 kpr_publisher
colval=Trim(colval);
 if (colname=="1")
   window.document.frmPrdDetails.swhere.value="apr_title like '"+ colval + "%'" ;
 else if (colname=="2")
   {
   colval=Trim(colval)    
   colSplit=colval.split(',')
   allWhereClause=""
   if (colSplit.length > 0 )
    {
   	 for (var colLen=0; colLen<colSplit.length; colLen++)
    	 {
    	   whereclause = ""
           colSplitSpace=Trim(colSplit[colLen]).split(' ')
	   
           if (colSplitSpace.length > 1 )
            {
           	 for (var k=0; k<colSplitSpace.length; k++)
            	 {
              //	  if (k==0)
              //      whereclause= " apr_artist like '%"+colSplitSpace[k]+"%'";
              //    else
              //     whereclause= whereclause + " and apr_artist like '%"+colSplitSpace[k]+"%'";  
                   if (whereclause != "")
                    whereclause= whereclause + " AND ";
                    whereclause= whereclause + String.fromCharCode(34)+colSplitSpace[k]+String.fromCharCode(34);
              
                 }
            }
            else
            {
             if (colSplitSpace != "")
               //hereclause= " apr_artist like '"+colSplitSpace+"%'";
               whereclause= String.fromCharCode(34)+colSplitSpace+String.fromCharCode(34);
            }
            if (whereclause!= "")
            {
              if (allWhereClause != "")
                 allWhereClause = allWhereClause + " or ";
              allWhereClause =  allWhereClause + "( " + whereclause + " ) ";
            }  
         }  
    }  
  //   alert(allWhereClause);
      //window.document.frmPrdDetails.swhere.value=allWhereClause ;
      window.document.frmPrdDetails.swhere.value= " contains(apr_artist, ' " + allWhereClause + " ') ";
 //   window.document.frmPrdDetails.swhere.value="apr_artist like '"+ colval + "%' " ;

   }


 else if (colname=="3")
   window.document.frmPrdDetails.swhere.value="apr_composer like '"+ colval + "%'" ;
 else if (colname=="4")
   window.document.frmPrdDetails.swhere.value="apr_publisher like '"+ colval + "%'" ;
 else if (colname=="5")
   window.document.frmPrdDetails.swhere.value="apr_sort_code in ("+ colval + ")" ;
 else if (colname=="6")
   window.document.frmPrdDetails.swhere.value="apr_artist like '"+ colval + "%'" ;
 else if (colname=="7")
   window.document.frmPrdDetails.swhere.value="kpr_title like '"+ colval + "%'" ;
 else if (colname=="8")
  {
   colval=Trim(colval)
//alert(colval);
   colSplit=colval.split(',')
   allWhereClause=""
   if (colSplit.length > 0 )
    {
   	 for (var colLen=0; colLen<colSplit.length; colLen++)
    	 {
//alert(colSplit[colLen]);
    	   whereclause = ""
           colSplitSpace=Trim(colSplit[colLen]).split(' ')
           if (colSplitSpace.length > 1 )
            {
           	 for (var k=0; k<colSplitSpace.length; k++)
            	 {
                  if (whereclause != "")
                    whereclause= whereclause + " AND ";
                  whereclause= whereclause + String.fromCharCode(34)+colSplitSpace[k]+String.fromCharCode(34);
                 }
            }
            else
            {
             if (colSplitSpace != "")
               whereclause= String.fromCharCode(34)+colSplitSpace+String.fromCharCode(34);
            }
            if (whereclause!= "")
            {
              if (allWhereClause != "")
                 allWhereClause = allWhereClause + " or ";

              allWhereClause =  allWhereClause + "( " + whereclause + " ) ";
            }
         }
    }
     //alert(allWhereClause);
     window.document.frmPrdDetails.swhere.value= " contains(kpr_author_index, ' " + allWhereClause + " ') ";

   }

 else if (colname=="9")
   window.document.frmPrdDetails.swhere.value="kpr_sub_title like '"+ colval + "%'" ;
 else if (colname=="10")
   window.document.frmPrdDetails.swhere.value="kpr_publisher like '"+ colval + "%'" ;
 else if (colname=="11")
 {
   colsortSplit=colval.split('**')
   colsortVal=Trim(colsortSplit[0])
   colval=colsortSplit[1]
   colvalSplit= colval.split(',');
   for (var n=0; n<colvalSplit.length; n++)
    {
      if (n==0)
        LikeClause= "apr_artist like '"+colvalSplit[n]+"%'" ;
      else
        LikeClause= LikeClause + "or apr_artist like '"+colvalSplit[n]+"%'";
    }
   if (colsortVal=="")
     window.document.frmPrdDetails.swhere.value=LikeClause
   else
     window.document.frmPrdDetails.swhere.value="apr_sort_code in ("+ colsortVal + ") and (" + LikeClause  + ") "
 }
 else if (colname=="12")
   window.document.frmPrdDetails.swhere.value="kpr_new_prd_group in ("+ colval + ")" ;
 else if (colname=="15") //For the New Releases Screen both KNO and AMS handled in this screen we get where condition
 {
   colvalSplit=colval.split('**')
   for (var n=0; n<colvalSplit.length; n++)
    {
      if (n==0)
        whereClause= colvalSplit[n];
      else
        whereClause= whereClause + "'"+colvalSplit[n];
    }
   window.document.frmPrdDetails.swhere.value=whereClause;
   window.document.frmPrdDetails.cboOrdBy.value=7;
 }
 else if (colname=="16")
   window.document.frmPrdDetails.swhere.value="apr_ean_code in ("+ colval + ")" ;
 else if (colname=="17")
 {
   colvalSplit= colval.split(',');
   LikeClause= "";
   whereClause="";
   for (var n=0; n<colvalSplit.length; n++)
    {
     colisbn=Trim(colvalSplit[n])
     if (Trim(colisbn)!="")
     {
       if (LikeClause != "")
        {
          LikeClause= LikeClause + " OR ";
        }
        LikeClause= LikeClause + String.fromCharCode(34)+colisbn+String.fromCharCode(34) ;
     }
    }
    whereClause = " contains(kpr_isbn,'"+LikeClause+"')";
   window.document.frmPrdDetails.swhere.value= whereClause;
 }
 else if (colname=="18")
   window.document.frmPrdDetails.swhere.value="apr_sell_price < "+ colval+ " " ;
 else if (colname=="19"){
   colvalSplit= colval.split(',');
   if (colvalSplit.length>1)
   {
     window.document.frmPrdDetails.swhere.value="apr_age_limit between "+ colvalSplit[0] + " and  " + colvalSplit[1]  ;
   }
   else {
     window.document.frmPrdDetails.swhere.value="apr_age_limit > "+ colval + " " ;
   }
 }
 else if (colname=="20")
   window.document.frmPrdDetails.swhere.value="apr_artist like '%"+ colval + "%' " ;
 else if (colname=="21")
   window.document.frmPrdDetails.swhere.value="kpr_author_index like '"+ colval + "'" ;
 else if (colname=="22")
   window.document.frmPrdDetails.swhere.value="cast(kpr_price_euroD as decimal) < cast("+ colval + " as decimal) "  ;
 else if (colname=="23")
 {
   colvalSplit= colval.split(',');
   if (colvalSplit.length>1)
   {
    whereClause="case when len(kpr_age_limit)=3 then left(kpr_age_limit,1) when len(kpr_age_limit)>3 then left(kpr_age_limit,2) else 0 end  between "+colvalSplit[0]+" and "+colvalSplit[1]+" and ";
    whereClause=whereClause+" case when len(kpr_age_limit)=3 then right(kpr_age_limit,2) when len(kpr_age_limit)>3 then right(kpr_age_limit,2) else 99 end between "+colvalSplit[0]+" and "+colvalSplit[1];
   }
   else
   {
    whereClause="case when len(kpr_age_limit)<=2 then kpr_age_limit when len(kpr_age_limit)>2 then SUBSTRING(CAST(kpr_age_limit as varchar(10)),len(kpr_age_limit)-1,2) else 99 end <"+colvalSplit[0];
   }
    window.document.frmPrdDetails.swhere.value=whereClause;
 }
 else if (colname=="24")
   window.document.frmPrdDetails.swhere.value="kpr_new_prd_group in ("+ colval + ")"; 
 else if (colname=="25")
  window.document.frmPrdDetails.swhere.value=colval
 else if (colname=="26")
   window.document.frmPrdDetails.swhere.value="kpr_classfy_title_type like '"+ colval + "' " ;
 else if (colname=="27")
   window.document.frmPrdDetails.swhere.value="kpr_classify_lang like '"+ colval + "' " ;
 else if (colname=="28")
   window.document.frmPrdDetails.swhere.value="apr_phononet in ("+ colval + ")" ;
 
   if (catdesc)
       window.document.frmPrdDetails.action="ProductsList.asp?domain=" + domain+ "&ctdesc="+catdesc;
   else
      window.document.frmPrdDetails.action="ProductsList.asp?domain=" + domain;

   if (colname=="25")
      window.document.frmPrdDetails.action= window.document.frmPrdDetails.action + "&cmscode=1";
   
 
 if(colval!='' && colname!='')
 {
  window.document.frmPrdDetails.submit();
  }
}
function DomImage(objimg, domtype)
{
  if (domtype=="1")
    domlogo="/Images/ThumbSbook.gif";
  else if (domtype=="2")
    domlogo="/Images/ThumbSAbook.gif";
  else if (domtype=="3")
    domlogo="/Images/ThumbSmusic.gif";
  else if (domtype=="4")
    domlogo="/Images/ThumbSfilm.gif";
  else if (domtype=="5")
    domlogo="/Images/ThumbSsoftware.gif";
  else if (domtype=="6")
    domlogo="/Images/ThumbSgames.gif";

  objimg.src=domlogo;
  objimg.width=45;
  objimg.height=45;
}
function DomImageBig(objimg, domtype)
{
  if (domtype=="1")
    domlogo="/Images/Thumbbook.gif";
  else if (domtype=="2")
    domlogo="/Images/ThumbAbook.gif";
  else if (domtype=="3")
    domlogo="/Images/Thumbmusic.gif";
  else if (domtype=="4")
    domlogo="/Images/Thumbfilm.gif";
  else if (domtype=="5")
    domlogo="/Images/Thumbsoftware.gif";
  else if (domtype=="6")
    domlogo="/Images/Thumbgames.gif";

  objimg.src=domlogo;
  objimg.width=70;
  objimg.height=120;
}

function isValidURL(formName,fieldName,flag){
      var email=document.forms[formName].elements[fieldName].value;
  if (email==0)    {
  return true;
  }else {
      emails=new String(email.substring(0,4));
      if(emails=='www.' && email.length>4){
         email=email.substring(4,email.length);
         emails=new String(email.substring(0,4));
      }
      var indexcount=email.lastIndexOf('.');
      if (indexcount==-1) {
            window.alert('Unzulässiges URL!');
            document.forms[formName].elements[fieldName].focus();
            document.forms[formName].elements[fieldName].select();
            return false;
      }
      else {
        var indexcount2=email.lastIndexOf('.');
        var mail=new String(email.substring(indexcount2+1,email.length));
        var len =mail.length;
        if(len<2){
            window.alert('Unzulässiges URL!');
            document.forms[formName].elements[fieldName].focus();
            document.forms[formName].elements[fieldName].select();
            return false;
        }
        return true;
     }
   return true;
 }
}

function fnNumeric(val)
{
	
	var a=val.value;
	var len=a.length;
	var spchr=Array();
	var cntdot;
	cntdot=0
	for(i=0;i<len;i++)
	{
		spchr[i]=a.charAt(i);
		
		if (spchr[i]==",")
		{
			cntdot++;
		}
		if (spchr[i]!=",")
		{
			if (isNaN(spchr[i]))
			{
				alert("Enter valid data");
				val.focus();
				val.select();
				return false;
			}
		}
		if ((cntdot>1) || (spchr[0]==",") || (spchr[len-1]==",") || (spchr[i]==" "))
		{
			alert("Enter valid data sai");
			val.focus();
			val.select();
			return false;
		}
	}
	 return true;
}

 function ValidateKey(f1,f2,f3,f4,f5) 
        {   

           var key=window.event.keyCode;
           if (f3=='all')
           {
             var allowed='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ:;,.?!£$%^&*()_+-*{}@~<>&"\0123456789';
               }
           else if (f3=='char')
           {
            var allowed='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
               }
               else if (f3=='charspace')
           {
            var allowed='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
               }
           else if (f3=='charwithdot')
           {
            var allowed='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.';
               }
               else if (f3=='date')
           {
            var allowed='0123456789/';
                   }
           else if (f3=='alphanumerics')
           {
            var allowed='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-';
              }
              else if (f3=='alphanumericswithoutifon')
              {
               var allowed='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
              }
              
              else if (f3=='onlynumbers')
           {
            var allowed='0123456789';
              }
               
              else if (f3=='onlynumberswithcoma')
           {
            var allowed='0123456789,';
              }
              else if (f3=='onlynumberswithminusandcoma')
           {
            var allowed='0123456789';
              }
           else if (f3=='numerics')
           {
             var allowed='0123456789.-';
               }
                else if (f3=='decimal')
           {
             var allowed='0123456789.';
               }
           else if (f3=='i')
           {
             var allowed='0123456789-';
               }
           else if (f3=='s')
           {
             var allowed=f4;
               }
           if (f3!='')
           {
              if (key!=13)
              {
                 if (allowed.indexOf(String.fromCharCode(key))==-1) 
                 {
                    key=0;  
                 }
              }
           }

           if (f3=='n'||f3=='i')
           {    
              if (key==46)
              {
                 if (f1.value.indexOf('.')>-1)
                 {
                    key=0;
                            }
              }
           }

           
           if (f5=='u')
           {
              var newkey=String.fromCharCode(key).toUpperCase();
              key=newkey.charCodeAt(0);
                  }
           else if (f5=='l')
           {
              var newkey=String.fromCharCode(key).toLowerCase();
              key=newkey.charCodeAt(0);
                  }

           window.event.keyCode=key;
   }

function loginchk()
{
//alert("hi");
var txtuid=document.getElementById('txtuid').value;
if((isMandatory('frmlogin','txtuid'))&&(isMandatory('frmlogin','txtpwd')))
{
    
	 document.frmlogin.action= "kundelogin.aspx?mode=check";
	 window.document.frmlogin.submit();
	// return true;					
}
//trims special characters in the username texbox			
if(!trimSpecialChar(txtuid))
	return false;				
}


function submitSearch(frmName)
{
var formname = frmName;

  //for(i=0; i<document.forms.length; i++){
  // alert(document.forms[i].name)
  //}
   // frmName.submit();
   // alert(document.forms[frmName].name + ' << name ');
    document.forms[formname].submit();
  // document.frmName.submit();
}

//Fastorder validation
//Fastorder validation

function submitFONewPartneFrm()
{
  debugger;
    if((isMandatory('frmFastOrder','txtFamilyName'))
    &&(isMandatory('frmFastOrder','txtAddr1'))
    &&(isMandatory('frmFastOrder','txtplz_strasse'))
    &&(isMandatory('frmFastOrder','txtort'))
    &&(isMandatory('frmFastOrder','drpLieferland'))
    &&(isMandatory('frmFastOrder','txtemail')))
    {
        //for date validation
        var d=window.document.frmFastOrder["txtgebdatum_tag"].value;
        var m=window.document.frmFastOrder["txtgebdatum_monat"].value;
        var y=window.document.frmFastOrder["txtgebdatum_jahr"].value;
        var emailid=window.document.frmFastOrder["txtemail"].value;
        // Check for valid date       

        // to check out for a valid email address
        if(!(isValidEmaill('frmFastOrder','txtemail',false)))
        {
            window.document.frmFastOrder["txtemail"].select();
            window.document.frmFastOrder.htxtflag.value=='';
        }

        // to check out for a valid email address
        else if(!(isValidEmaill('frmFastOrder','txtemail',false)))
        {
            window.document.frmFastOrder["txtemail"].select();
            window.document.frmFastOrder.htxtflag.value=='';
        }
        // checking the correct password
//        else if(window.document.frmFastOrder.txtpasswort.value !=window.document.frmFastOrder.txtpasswortwh.value)
//        {
//            alert("Bitte geben Sie das gEtige Passwort ein!");
//            window.document.frmFastOrder.txtpasswortwh.value='';
//        }
        else if(document.frmFastOrder.txtEmail_Sperre1.checked==true)
        {
            if((isMandatory('frmFastOrder','txtrecFamilyName'))
            &&(isMandatory('frmFastOrder','txtrecAddr1'))
            &&(isMandatory('frmFastOrder','txtrecplz_strasse'))
            &(isMandatory('frmFastOrder','txtrecort')))
            {
               // document.frmFastOrder.htxtflag.value="submit";
               // window.document.frmFastOrder.submit();
            }
        }  
        //else if(window.document.frmFastOrder["txtgebdatum_tag"].value!='' || window.document.frmFastOrder["txtgebdatum_monat"].value!='' ||  window.document.frmFastOrder["txtgebdatum_jahr"].value!='')
        //{
         //   if(!(gtdate(d,m,y)))
          //  {
           //     alert("UngEtiges Geburtsdatum");
           //     window.document.frmFastOrder["txtgebdatum_tag"].select();
           //     window.document.frmFastOrder.htxtflag.value=='';
           // }
            //else
            //{
            //    document.frmFastOrder.htxtflag.value="submit";
            //    window.document.frmFastOrder.submit();
            //}
        //}
        //else if(window.document.frmFastOrder.rdoPrePay.checked == false && window.document.frmFastOrder.rdoByAcc.checked == false)
        //{
         //   alert("W\U+00E hlen Sie die Zahlungsweise");
         //   window.document.frmFastOrder.htxtflag.value=='';
        //    return false
       // }
        else if(!window.document.frmFastOrder.ChckAGB.checked) 
        {
            //alert('Sie müssen unseren AGBs zustimmen, um Ihre Bestellung abschliessen zu können');
            alert('Sie m\u00FCssen unseren AGBs zustimmen, um Ihre Bestellung abschliessen zu k\u00F6nnen');
            window.document.frmFastOrder.htxtflag.value=='';
            return false;
        }
        else
        {
            if(CheckCardNumber())
            {
                //assigning to a temporary variable and submiting the form
                document.frmFastOrder.hdnorder.value='save';
                document.frmFastOrder.htxtflag.value="submit";
                //window.document.frmFastOrder.submit();
                return true;
            }
            else
                return false;
        }	 
    }
    else
        return false;
}
function disableFOcaddress()
{
	
	document.frmFastOrder.drpcborecanrede.value='';
	document.frmFastOrder.txtrecAddr.value='';
	document.frmFastOrder.txtrecFirstName.value='';
	document.frmFastOrder.txtrecFamilyName.value='';
	document.frmFastOrder.txtrecAddr1.value='';
	document.frmFastOrder.txtrecAddr2.value='';
	document.frmFastOrder.txtrecplz_strasse.value='';
	document.frmFastOrder.txtrecort.value='';
	
	
	document.frmFastOrder.drpcborecanrede.disabled=true;
	document.frmFastOrder.txtrecAddr.disabled=true;
	document.frmFastOrder.txtrecFirstName.disabled=true;
	document.frmFastOrder.txtrecFamilyName.disabled=true;
	document.frmFastOrder.txtrecAddr1.disabled=true;
	document.frmFastOrder.txtrecAddr2.disabled=true;
	document.frmFastOrder.txtrecplz_strasse.disabled=true;
	document.frmFastOrder.txtrecort.disabled=true;
	
}
function enableFOcaddress()
{

	document.frmFastOrder.drpcborecanrede.disabled=false;
	document.frmFastOrder.txtrecAddr.disabled=false;
	document.frmFastOrder.txtrecFirstName.disabled=false;
	document.frmFastOrder.txtrecFamilyName.disabled=false;
	document.frmFastOrder.txtrecAddr1.disabled=false;
	document.frmFastOrder.txtrecAddr2.disabled=false;
	document.frmFastOrder.txtrecplz_strasse.disabled=false;
	document.frmFastOrder.txtrecort.disabled=false;
}
