// 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 isValidEmail(str)
{
    var at="@"
    var dot="."
    var lat=str.indexOf(at)
    var lstr=str.length
    var ldot=str.indexOf(dot)
    if (str.indexOf(at)==-1)
    {
       return false
    }

    if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr)
    {
       return false
    }

    if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr)
    {
        return false
    }

    if (str.indexOf(at,(lat+1))!=-1)
    {
        return false
    }

    if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot)
    {
        return false;
    }

    if (str.indexOf(dot,(lat+2))==-1)
    {
        return false;
    }
	
    if (str.indexOf(" ")!=-1)
    {
        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;
	    //alert(val);
	}
	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  check for mandatory fields
function isMandatory2(formName, fieldName,divName,labelName)
{
	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)
	{
	    document.getElementById(divName).style.display='block';
	    document.getElementById(labelName).innerText=' Eingabe '+ dname+ ' notwendig! ';
	    document.getElementById(labelName).textContent=' Eingabe '+ dname+ ' notwendig! ';
	    document.forms[formName].elements[fieldName].focus();
		return false;
	}
	else
	{
	    document.getElementById(divName).style.display='none';
	    document.getElementById(labelName).innerText='';
	    document.getElementById(labelName).textContent='';
	    return true;
	}
}
//end isMandatory

//function to check for mandatory fields and show error messages beside the control

function isMandatory1(formName,fieldName,errorlabel)
{
    var error=document.getElementById(errorlabel);
    if(document.forms[formName].elements[fieldName].value==0)
    {
        error.innerText=' Eingabe notwendig! ';
        error.textContent =' Eingabe notwendig! ';
        return false;
    }
    else if(fieldName=='txtuid' || fieldName=='txtuser')
    {
    //this function is used to check whether entered text in txtuid is a valid emailid
     if(isValidEmail(document.forms[formName].elements[fieldName].value)==false)
     {
        error.innerText=' Eingabe Email Adresse! ';
        error.textContent =' Eingabe Email Adresse! ';
        return false;
     }
     else
     {
        error.innerText='';
        error.textContent='';
        return true;
     }
    }
    else
    {
        error.innerText='';
        error.textContent='';
        return true;
    }
}

//end 

//==============

// Removes all special characters which do NOT appear in string bag from string for the password. by suman 17-04-2007
function stripCharsNotInBag(formName, fieldName)
{
    var i;
    var returnString = "";
	//var stringval = document.forms[formName].elements[fieldName].value;
	var stringval = fieldName;
	var iChar = "'/*!=";		  //characters not considered
	
    // Search through string's characters one by one.If character is in bag, append to returnString.
    for (i = 0; i < stringval.length; i++)
    {   
        // Check that current character isn't whitespace.
        var ichar = stringval.charAt(i);
        if (bag.indexOf(ichar) != -1)
			 returnString += ichar;
    }
    return returnString;
}

//function to accept only Numeric characters  ** by suman 11-04-07
//i.e. other that numeric characters we schould raise an alert if entered
function validNumeric(formName, field) {
	var valid = "0123456789"
	var ok = "yes";
	//var number = document.forms[formName].elements[field].value;
	//var number =  document.forms[formName].elements[field].value;	
	var number = field;
	var temp;
	for (var i=0; i<number.length; i++) 
	{
		temp = "" + number.substring(i, i+1);
		if (valid.indexOf(temp) == "-1")
		{
		 ok = "no";	
		}		
	}
	if (ok == "no") 
	{
		alert("Invalid entry!  Only Numeric Characters are accepted!");
		// document.forms[formName].elements[field].focus();
		// document.forms[formName].elements[field].select();
		return false;
	}
	else
	{
	return true;
	}
	
}


//function to validate for only few special characters  ** by suman 11-04-07
//i.e raise an alert if there is any special character found
function validSpecialChar(formName, fieldName)
{
	var result = true;
	//var stringval = document.forms[formName].elements[fieldName].value;
	var stringval = fieldName;
	var size = stringval.length;
	var iChars = "*|,\":<>[]{}`\;()#.!^'";		  //characters not considered
	for (var i = 0; i < size; i++) 
	{
		if (iChars.indexOf(size.charAt(i)) != -1)
			result = false;
	}
	if(result = false)
	{
		alert('Please enter a proper value for the "' + fieldName +'" field.');
	}
	result = false;
}


//function to validate for all special characters ** by suman 11-04-07
//i.e raise an alert if there is any special character found
function validAllSpecialChar(formName, fieldName)
{
	var result = true;
	//var string = document.forms[formName].elements[fieldName].value;				
	var string = fieldname;
	var size = string.length;
	var iChars = "*|,\":<>[]{}`/?;()@&$#%.!^'";   //characters not considered
	for (var i = 0; i < size; i++) 
	{
		if (iChars.indexOf(size.charAt(i)) != -1)
			result = false;
	}
	if(result = false)
	{
		alert('Please enter a proper value for the "' + fieldName +'" field.');
	}
	result = false;
}

//function to trim all the special character and append the string    ** by suman 11-04-07
function trimSpecialChar(input)   
{
	var s;
	s = input;
	filteredValues = "*|,\":<>[]{}`/?;()&$#%!^' ";   // Characters stripped out
	var i;
	var returnString = "";
	// Search through string and append to unfiltered values to returnString.
	for (i = 0; i < s.length; i++)
	{
		var c = s.charAt(i);
		if (filteredValues.indexOf(c) == -1) returnString += c;
	}
	input.value = returnString;
}


//function to check for the spaces    ** by suman 11-04-07
//i.e is any spaces are entered in the fields then raise an alert
function checkSpaces(formname, textboxname, displaytext)
{
  // define valid characters
  var valid = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_'; 
  var localerror = '';
  if(!isValid(Trim(eval('document.'+formname+'.'+textboxname+'.value')), valid))
   {
    localerror =  '- '+displaytext+' Should Not Contain Spaces.\n';
   } 
  else 
	localerror = '';
  return localerror;
}

//function to accept only alphanumeric characters    ** by suman 11-04-07
//i.e. other that alpha numeric characters we schould raise an alert if entered
function validAlphaNumeric(field) {
	var valid = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
	var ok = "yes";
	var temp;
	for (var i=0; i<field.value.length; i++) 
	{
		temp = "" + field.value.substring(i, i+1);
		if (valid.indexOf(temp) == "-1")
		 ok = "no";
	}
	if (ok == "no") 
	{
		alert("Invalid entry!  Only Alphanumeric are accepted!");
		field.focus();
		field.select();
	}
}


//==========================

// 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 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・tige 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)
 {
 alert('in the isNum');
 alert(document.forms[formName].elements[fieldName].value);
  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・tige 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_ean,'"+LikeClause+"')";
    //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舖siges 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舖siges 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");
			val.focus();
			val.select();
			return false;
		}
	}
	 return true;
}

//The following functions are used for Kundelogin page


function loginchk()
{
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 loginchk1()
{
var txtuid=document.getElementById('txtuid').value;
if((isMandatory1('frmlogin','txtuid','txtuiderror'))&&(isMandatory1('frmlogin','txtpwd','txtpwderror')))
{
	 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 pwdCheck(txtuser)
{
if(isMandatory('frmlogin1','txtuser'))
{
	document.frmlogin1.par_email.value=document.frmlogin1.txtuser.value;	
	document.frmlogin1.action = "kundelogin.aspx?mode=validate";
	//document.frmlogin1.submit();
	return true;
}			
if(!trimSpecialChar(txtuser))
	return false;
	//trims the the special characters for the email-password 
if (!stripCharsNotInBag(document.forms[frmlogin.name], txtpwd))
	return false;
}

function pwdCheck1()
{
    var txtuser=document.getElementById('txtuser').value;
    if(isMandatory1('frmlogin1','txtuser','lblMsg'))
    {
	    document.frmlogin1.par_email.value=document.frmlogin1.txtuser.value;	
	    document.frmlogin1.action = "kundelogin.aspx?mode=validate";
	    //document.frmlogin1.submit();
	    return true;
    }			
    if(!trimSpecialChar(txtuser))
	    return false;
	    //trims the the special characters for the email-password 
    if (!stripCharsNotInBag(document.forms[frmlogin.name], txtpwd))
	    return false;
}



//@@<!!!!Begin the function for removing the specified characters form the inputbox
function dodacheck(val)
{
var mikExp = /[\\%\^\*\(\)\[\]\_\{\}\`\~\=\|]/;
var strPass = val.value;
var strLength = strPass.length;
var lchar = val.value.charAt((strLength) - 1);
if(lchar.search(mikExp) != -1) 
{
	var tst = val.value.substring(0, (strLength) - 1);
	val.value = tst;
}
}

function doanothercheck(form) 
{
var mikExp = /[\\%\^\*\(\)\[\]\_\{\}\`\~\=\|]/;
if(form.value.length < 1) 
{
	alert("Please enter something.");
	return false;
}
if(form.value.search(mikExp) == -1) 
{
	//alert("Correct Input");						
	return false;
}
else 
{
	alert("Sorry, but the following characters\n\r\n\r@ $ % ^ & * # ( ) [ ] \\ { + } ` ~ =  | \n\r\n\rare not allowed!\n");
	form.select();
	form.focus();
	return false;
}
alert("Correct Input");
return false;
}

// The following function is used for meinkonto.aspx

function call_logout()
{
window.document.frm_meinkonto.hdnlogout.value='logout';
window.document.frm_meinkonto.submit();
}
// The following function is used for popup_delivery.aspx 
function submitdlvfrm()
{
if ((isMandatory2('popup_delivery','txtFamilyName','divError','lblMsg'))
    &&(isMandatory2('popup_delivery','txtAdd1','divError','lblMsg'))
    &&(isMandatory2('popup_delivery','txtPostcode','divError','lblMsg'))
    &&(isMandatory2('popup_delivery','txtCity','divError','lblMsg'))
    &&(isMandatory2('popup_delivery','drpCountry','divError','lblMsg')))
       
    {
        document.popup_delivery.htxtsubAct.value="Edit"; 
        window.document.popup_delivery.submit();
    }
    else
    {
        return false;
    }

}

// The following function is used for deliveryaddress.aspx 

function submitfrm(divName,labelName)
{
    if ((isMandatory2('frmDlvAddr','drpAnrede','divError','lblErrorMsg'))
    &&(isMandatory2('frmDlvAddr','txtFirstName','divError','lblErrorMsg'))
    &&(isMandatory2('frmDlvAddr','txtFamilyName','divError','lblErrorMsg'))
    &&(isMandatory2('frmDlvAddr','txtAdd1','divError','lblErrorMsg'))
    &&(isMandatory2('frmDlvAddr','txtPostcode','divError','lblErrorMsg'))
    &&(isMandatory2('frmDlvAddr','txtCity','divError','lblErrorMsg'))
    &&(isMandatory2('frmDlvAddr','drpCountry','divError','lblErrorMsg')))
    {
        var txtPostcode=window.document.frmDlvAddr["txtPostcode"];
        //To check for if txtPostcode as entered only numbers
        if(!ValidatePostalCode(txtPostcode.value))
        {
            document.getElementById(divName).style.display='block';
            document.getElementById(labelName).innerText=' Geben Sie in Numerik Postleitzahl! ';
            document.getElementById(labelName).textContent=' Geben Sie in Numerik Postleitzahl! ';
            txtPostcode.focus();
            return false;
        }
        else
        {
            
            document.getElementById(divName).style.display='none';
            document.getElementById(labelName).innerText='';
            document.getElementById(labelName).textContent='';
            document.frmDlvAddr.htxtsubAct.value="Edit"; 
            window.document.frmDlvAddr.submit();
        }
    }
    else
    {
        return false;
    }
}
function cOn(td)
{
	if(document.getElementById||(document.all && !(document.getElementById)))
	{
	td.style.backgroundColor="#FBF3DF";
    }
}

function cOut(td)
{		
    if(document.getElementById||(document.all && !(document.getElementById)))
    {
    td.style.backgroundColor="#FFFFFF";
    }
}

function onOut()
        {
            var email=document.getElementById('txtbenutzer').value;
            document.getElementById('txtemail').value=email;
        }

// The following functions are used for rechnungen.aspx

function showOrddet(ocode)
{
window.open("DrunkRechnung.aspx?ordcode="+encodeURIComponent(ocode),"mywin",'toolbar=0,status=0,menubar=0,scrollbars=yes,resizable=no,width=900,height=450,left=30,top=30');
//window.showModalDialog("DrunkRechnung.aspx?ordcode="+ocode,"mywin",'toolbar=0,status=0,menubar=0,scrollbars=yes,resizable=no,width=900,height=450,left=30,top=30');
}
			
// The following functions are used for newpartner.aspx
        
 function submitNewPartneFrm(divName,labelName)
 {
 
    document.frmneukunde.htxtflag.value="";
    if((isMandatory2('frmneukunde','txtbenutzer','divError','lblErrorMsg'))
    &&(isMandatory2('frmneukunde','txtpasswort','divError','lblErrorMsg'))
    &&(isMandatory2('frmneukunde','txtpasswortwh','divError','lblErrorMsg'))
    &&(isMandatory2('frmneukunde','txtFamilyName','divError','lblErrorMsg'))
    &&(isMandatory2('frmneukunde','txtAddr1','divError','lblErrorMsg'))
    &&(isMandatory2('frmneukunde','txtplz_strasse','divError','lblErrorMsg'))
    &&(isMandatory2('frmneukunde','txtort','divError','lblErrorMsg'))
    &&(isMandatory2('frmneukunde','drpLieferland','divError','lblErrorMsg')))
    {
        //for date validation
        var d=window.document.frmneukunde["txtgebdatum_tag"].value;
        var m=window.document.frmneukunde["txtgebdatum_monat"].value;
        var y=window.document.frmneukunde["txtgebdatum_jahr"].value;
        var emailid=window.document.frmneukunde["txtemail"].value;
        var txtPhone=window.document.frmneukunde["txttelefon"];
        var txtFax=window.document.frmneukunde["txttelefax"];
        var txtplz_strasse=window.document.frmneukunde["txtplz_strasse"];
        var txtrecplz_strasse=window.document.frmneukunde["txtrecplz_strasse"];
      
            
        // Check for valid date       
        
        //Function to check for valid EmailID format
        if(!isValidEmail(document.getElementById('txtbenutzer').value))
        {
            document.getElementById(divName).style.display='block';
            document.getElementById(labelName).innerText=' Eingabe Email Adresse! ';
            document.getElementById(labelName).textContent=' Eingabe Email Adresse! ';
            window.document.frmneukunde["txtbenutzer"].select();
            window.document.frmneukunde.htxtflag.value=='';
            return false;
        }
        else if(!isValidEmail(document.getElementById('txtemail').value))
        {
            document.getElementById(divName).style.display='block';
            document.getElementById(labelName).innerText=' Eingabe Email Adresse! ';
            document.getElementById(labelName).textContent=' Eingabe Email Adresse! ';
            window.document.frmneukunde["txtemail"].select();
            window.document.frmneukunde.htxtflag.value=='';
            return false;
        }
        //To check for if txtPostcode as entered only numbers
        else if(!ValidatePostalCode(txtplz_strasse.value))
        {
            document.getElementById(divName).style.display='block';
            document.getElementById(labelName).innerText=' Geben Sie in Numerik Postleitzahl! ';
            document.getElementById(labelName).textContent=' Geben Sie in Numerik Postleitzahl! ';
            txtplz_strasse.focus();
            return false;
        }
        else if(!ValidatePostalCode(txtrecplz_strasse.value))
        {
            document.getElementById(divName).style.display='block';
            document.getElementById(labelName).innerText=' Geben Sie in Numerik Postleitzahl! ';
            document.getElementById(labelName).textContent=' Geben Sie in Numerik Postleitzahl! ';
            txtrecplz_strasse.focus();
            return false;
        }
        //To check for if txtphone as entered only numbers
        else if(isNumeric(txtPhone.value)==false)
        {
            document.getElementById(divName).style.display='block';
            document.getElementById(labelName).innerText=' Geben Sie in Numerik Telefon! ';
            document.getElementById(labelName).textContent=' Geben Sie in Numerik Telefon! ';
            txtPhone.focus();
            return false;
        }//end
        //To check for if txtFax as entered only numbers
        if(isNumeric(txtFax.value)==false)
        {
            document.getElementById(divName).style.display='block';
            document.getElementById(labelName).innerText=' Geben Sie in Numerik Telefax! ';
            document.getElementById(labelName).textContent=' Geben Sie in Numerik Telefax! ';
            txtPhone.focus();
            txtFax.focus();
            return false;
        }//end
        // checking the correct password
        else if(window.document.frmneukunde.txtpasswort.value !=window.document.frmneukunde.txtpasswortwh.value)
        {
            document.getElementById(divName).style.display='block';
            document.getElementById(labelName).innerText=' Bitte geben Sie das g・tige Passwort ein! ';
            document.getElementById(labelName).textContent=' Bitte geben Sie das g・tige Passwort ein! ';
            window.document.frmneukunde.txtpasswortwh.value='';
            return false;
        }
        
        else if(document.frmneukunde.txtEmail_Sperre1.checked==true)
        {
            if((isMandatory2('frmneukunde','txtrecFamilyName','divError','lblErrorMsg'))
            &&(isMandatory2('frmneukunde','txtrecAddr1','divError','lblErrorMsg'))
            &&(isMandatory2('frmneukunde','txtrecplz_strasse','divError','lblErrorMsg'))
            &&(isMandatory2('frmneukunde','txtrecort','divError','lblErrorMsg')))
            {
            
                if(window.document.frmneukunde["txtgebdatum_tag"].value!='' || window.document.frmneukunde["txtgebdatum_monat"].value!='' ||  window.document.frmneukunde["txtgebdatum_jahr"].value!='')
                {
                    if(!(gtdate(d,m,y)))
                    {
                        document.getElementById(divName).style.display='block';
                        document.getElementById(labelName).innerText=' Ung・tiges Geburtsdatum ';
                        document.getElementById(labelName).textContent=' Ung・tiges Geburtsdatum ';
                        window.document.frmneukunde["txtgebdatum_tag"].select();
                        window.document.frmneukunde.htxtflag.value=='';
                        return false;
                    }
                    else
                    {
                        document.getElementById(divName).style.display='none';
                        document.getElementById(labelName).innerText='';
                        document.getElementById(labelName).textContent='';
                        document.frmneukunde.htxtflag.value="submit";
                        //window.document.frmneukunde.submit();
                        document.frmneukunde.action="newpartner.aspx"
                    }
                    
                }
                document.frmneukunde.htxtflag.value="submit";
                //window.document.frmneukunde.submit();
                document.frmneukunde.action="newpartner.aspx"
            }
            else
            {
            return false;
            }
        }  
        else if(window.document.frmneukunde["txtgebdatum_tag"].value!='' || window.document.frmneukunde["txtgebdatum_monat"].value!='' ||  window.document.frmneukunde["txtgebdatum_jahr"].value!='')
        {
            if(!(gtdate(d,m,y)))
            {
                document.getElementById(divName).style.display='block';
                document.getElementById(labelName).innerText=' Ung・tiges Geburtsdatum ';
                document.getElementById(labelName).textContent=' Ung・tiges Geburtsdatum ';
                window.document.frmneukunde["txtgebdatum_tag"].select();
                window.document.frmneukunde.htxtflag.value=='';
                return false;
            }
            else
            {
                document.getElementById(divName).style.display='none';
                document.getElementById(labelName).innerText='';
                document.getElementById(labelName).textContent='';
                document.frmneukunde.htxtflag.value="submit";
                //window.document.frmneukunde.submit();
                document.frmneukunde.action="newpartner.aspx"
            }
        }
        else
        {
            //assigning to a temporary variable and submiting the form
            document.getElementById(divName).style.display='none';
            document.getElementById(labelName).innerText='';
            document.getElementById(labelName).textContent='';
            document.frmneukunde.htxtflag.value="submit"; 
            //window.document.frmneukunde.submit();
           document.frmneukunde.action="newpartner.aspx"
        }	 
    }
    else
    {
        return false;
    }
}
//End Function        
        
		function disablecaddress()
		{
			
			document.frmneukunde.drpcborecanrede.value='';
			document.frmneukunde.txtrecAddr.value='';
			document.frmneukunde.txtrecFirstName.value='';
			document.frmneukunde.txtrecFamilyName.value='';
			document.frmneukunde.txtrecAddr1.value='';
			document.frmneukunde.txtrecAddr2.value='';
			document.frmneukunde.txtrecplz_strasse.value='';
			document.frmneukunde.txtrecort.value='';
			
			
			document.frmneukunde.drpcborecanrede.disabled=true;
			document.frmneukunde.txtrecAddr.disabled=true;
			document.frmneukunde.txtrecFirstName.disabled=true;
			document.frmneukunde.txtrecFamilyName.disabled=true;
			document.frmneukunde.txtrecAddr1.disabled=true;
			document.frmneukunde.txtrecAddr2.disabled=true;
			document.frmneukunde.txtrecplz_strasse.disabled=true;
			document.frmneukunde.txtrecort.disabled=true;
			
		}
		function enablecaddress()
		{
	
			document.frmneukunde.drpcborecanrede.disabled=false;
			document.frmneukunde.txtrecAddr.disabled=false;
			document.frmneukunde.txtrecFirstName.disabled=false;
			document.frmneukunde.txtrecFamilyName.disabled=false;
			document.frmneukunde.txtrecAddr1.disabled=false;
			document.frmneukunde.txtrecAddr2.disabled=false;
			document.frmneukunde.txtrecplz_strasse.disabled=false;
			document.frmneukunde.txtrecort.disabled=false;
		}
	

	
	
	//The following functions are used for OrderOverview.aspx
	
	function Qty_update(frmname,count )
	{
        if( Number(document.forms[frmname.name].prd_qty.value ) + count > 0 )

        {
	        document.forms[frmname.name].prd_qty.value = Number( document.forms[frmname.name].prd_qty.value ) + count;
        		
	        document.forms[frmname.name].submit();
        }					
        else
	        document.forms[frmname.name].prd_qty.value = 1;
	}	
	
	function checkout(dlvflag)
	{
	  if (dlvflag==0)
	  {
       document.frmlogin.submit(); 
      }
      else
      {
        //alert("Invalid delivery mode selection");
        document.getElementById('divError').style.display='block';
        document.getElementById('lblMsg').innerText='Invalid delivery mode selection';
        document.getElementById('lblMsg').textContent='Invalid delivery mode selection';
      }
       
	}
	
	
      
    function saveorder()
     {
         if(!window.document.frmOrderview.ChckAGB.checked) 
		 {
		    //alert('Sie mssen unseren AGBs zustimmen, um Ihre Bestellung abschliessen zu knnen');
		     document.getElementById('divError').style.display='block';
             document.getElementById('lblMsg').innerText='Sie mssen unseren AGBs zustimmen, um Ihre Bestellung abschliessen zu knnen';
             document.getElementById('lblMsg').textContent='Sie mssen unseren AGBs zustimmen, um Ihre Bestellung abschliessen zu knnen';
		 }
	     else
		 {
               window.document.frmOrderview.hdnorder.value='save';
               window.document.frmOrderview.imgnext.disabled=true;
               window.document.frmOrderview.submit();
         }
    }
    
     var popupWindow=null;
     function popWindow(pcode,padrcode,mode)
        {		
            var url = "popup_delivery.aspx?parcode="+pcode+"&padrcode="+padrcode+"&mode="+mode ;
            popupWindow = window.open(url,"mywin",'toolbar=0,status=0,menubar=0,scrollbars=no,resizable=no,width=600,height=500,left=400,top=280');
        }
        function popContact(pcode,padrcode)
        {		
	    var url="popup_personaldet.aspx?parcode="+pcode+"&padrcode="+padrcode;
            popupWindow = window.open(url,"mywin",'toolbar=0,status=0,menubar=0,scrollbars=no,resizable=no,width=600,height=500,left=400,top=280');
        }
    
        
        
          function disablePage()
          {
            var elems = document.getElementsByTagName('*');
            document.frmOrderview.ImgZuruck.disabled=true;
            document.frmOrderview.imgnext.disabled=true;
            for(var i = 0; i < elems.length; i++) 
            elems[i].disabled = true;
          }

        function enablePage() 
        {
          var elems = document.getElementsByTagName('*');

          for(var i = 0; i < elems.length; i++) 
            elems[i].disabled = false;
        }
        function parent_disable() 
        {
            if(popupWindow && !popupWindow.closed)
            popupWindow.focus();
        }
        
      
	

function isNumberKey(evt)
      {
         var charCode = (evt.which) ? evt.which : event.keyCode
         if (charCode > 31 && (charCode < 48 || charCode > 57))
            return false;

         return true;
      }
      
function validateTelefone(evt)
{
    var charCode = (evt.which) ? evt.which : event.keyCode
    if (charCode > 31 && (charCode < 48 || charCode > 57) && charCode!=43 && charCode!=45 && charCode!=32)
        return false;

    return true;
}
      
//Function to validate PersonalDetails Weiter Button      
    function submitPerData1(divName,labelName)
    {
        if ((isMandatory2('frmPersonalData','txtNachname','divError','lblErrorMsg'))
         && (isMandatory2('frmPersonalData','txtAddress1','divError','lblErrorMsg'))
         && (isMandatory2('frmPersonalData','txtPostcode','divError','lblErrorMsg'))
         && (isMandatory2('frmPersonalData','txtCity','divError','lblErrorMsg'))
         && (isMandatory2('frmPersonalData','drpCountry','divError','lblErrorMsg'))
         && (isMandatory2('frmPersonalData','txtEmail','divError','lblErrorMsg')))
        {
            var d=window.document.frmPersonalData["txtDate"].value;
            var m=window.document.frmPersonalData["txtMonth"].value;
            var y=window.document.frmPersonalData["txtYear"].value;
            var txtPhone=window.document.frmPersonalData["txtPhone"];
            var txtFax=window.document.frmPersonalData["txtFax"];
            //To check for if txtphone as entered only numbers
            if(isNumeric(txtPhone.value)==false)
            {
                document.getElementById(divName).style.display='block';
	            document.getElementById(labelName).innerText=' Geben Sie in Numerik Telefon! ';
	            document.getElementById(labelName).textContent=' Geben Sie in Numerik Telefon! ';
                txtPhone.focus();
                return false;
            }//end
            //To check for if txtFax as entered only numbers
            if(isNumeric(txtFax.value)==false)
            {
                document.getElementById(divName).style.display='block';
	            document.getElementById(labelName).innerText=' Geben Sie in Numerik Telefax! ';
	            document.getElementById(labelName).textContent=' Geben Sie in Numerik Telefax! ';
                txtPhone.focus();
                txtFax.focus();
                return false;
            }//end
            
            //Function to check for valid EmailID format
            if(!isValidEmail(document.getElementById('txtEmail').value))
            {
                document.getElementById(divName).style.display='block';
	            document.getElementById(labelName).innerText=' Eingabe Email Adresse! ';
	            document.getElementById(labelName).textContent=' Eingabe Email Adresse! ';
                window.document.frmPersonalData["txtEmail"].select();
                window.document.frmPersonalData.htxtsubAct.value=='';
                return false;
            }
            
            if(window.document.frmPersonalData["txtDate"].value!='' || window.document.frmPersonalData["txtMonth"].value!='' ||  window.document.frmPersonalData["txtYear"].value!='')
            {    
               if(!(gtdate(d,m,y)))
               {
                 document.getElementById(divName).style.display='block';
	             document.getElementById(labelName).innerText=' Ungltiges Geburtsdatum! ';
	             document.getElementById(labelName).textContent=' Ungltiges Geburtsdatum! ';
                 window.document.frmPersonalData["txtDate"].select();
                 window.document.frmPersonalData.htxtsubAct.value=='';
                 return false;
               }
               else
               {
                 document.getElementById(divName).style.display='none';
	             document.getElementById(labelName).innerText='';
	             document.getElementById(labelName).textContent='';
                 document.frmPersonalData.htxtsubAct.value="save";
                 window.document.frmPersonalData.submit();
               }
            }
            // to check out for a valid email address
            else
            {
                document.getElementById(divName).style.display='none';
	            document.getElementById(labelName).innerText='';
	            document.getElementById(labelName).textContent='';
                document.frmPersonalData.htxtsubAct.value="save";
                window.document.frmPersonalData.submit();
            }
        }
        else
        {
            return false;
        }
    }
    //end function
    
    //Function to check for numerics    
    function isNumeric(val)
    {
      var numeric = true;
      var chars = "0123456789-+";
      var len = val.length;
      var char = "";
      for (i=0; i<len; i++)
      {
          char = val.charAt(i);
          if (chars.indexOf(char)==-1)
          {
              numeric = false;
          }
      }
      return numeric;
    }
    //end function
   
   //Function to check for numerics in Postal Code
    function ValidatePostalCode(val)
    {
      var numeric = true;
      var chars = "0123456789";
      var len = val.length;
      var char = "";
      for (i=0; i<len; i++)
      {
          char = val.charAt(i);
          if (chars.indexOf(char)==-1)
          {
              numeric = false;
          }
      }
      return numeric;
    }
    //end function
   
   
   //Function to validate Length  
    function ValidateLength(oid,max)
    {
        if (event.keyCode < 48 || event.keyCode > 57)
        {                        
             alert("Enter Numbers Only");    
             return false;                  
        }
        
        var txt=oid.value;
        var length = txt.length;

        if(length>max-1)
        {
            alert("Enter only "+ max +" digits!");
            event.returnValue = false;
        }        
    }
    //end function
    
//Function To Validate Kontakt Form
function submitKontaktFrm(divName,labelName)
 {
    if((isMandatory2('kontaktfrm','Nametext','divError','lblErrorMsg'))
    &&(isMandatory2('kontaktfrm','Emailtext','divError','lblErrorMsg'))
    &&(isMandatory2('kontaktfrm','suggestionstext','divError','lblErrorMsg')))
    {
        //for date validation
        var Emailtext=window.document.kontaktfrm["Emailtext"].value;
        var Fontext=window.document.kontaktfrm["Fontext"];
        var Faxtext=window.document.kontaktfrm["Faxtext"];
        var Plztext=window.document.kontaktfrm["Plztext"];
        var txtrecplz_strasse=window.document.kontaktfrm["txtrecplz_strasse"];    
        
        //Function to check for valid EmailID format
        if(!isValidEmail(document.getElementById('Emailtext').value))
        {
            document.getElementById(divName).style.display='block';
            document.getElementById(labelName).innerText=' Eingabe Email Adresse! ';
            document.getElementById(labelName).textContent=' Eingabe Email Adresse! ';
            window.document.kontaktfrm["Emailtext"].select();
            return false;
        }
        //To check for if txtPostcode as entered only numbers
        else if(!ValidatePostalCode(Plztext.value))
        {
            document.getElementById(divName).style.display='block';
            document.getElementById(labelName).innerText=' Geben Sie in Numerik Postleitzahl! ';
            document.getElementById(labelName).textContent=' Geben Sie in Numerik Postleitzahl! ';
            Plztext.focus();
            return false;
        }
        //To check for if txtphone as entered only numbers
        else if(isNumeric(Fontext.value)==false)
        {
            document.getElementById(divName).style.display='block';
            document.getElementById(labelName).innerText=' Geben Sie in Numerik Telefon! ';
            document.getElementById(labelName).textContent=' Geben Sie in Numerik Telefon! ';
            Fontext.focus();
            return false;
        }//end
        //To check for if txtFax as entered only numbers
        else if(isNumeric(Faxtext.value)==false)
        {
            document.getElementById(divName).style.display='block';
            document.getElementById(labelName).innerText=' Geben Sie in Numerik Telefax! ';
            document.getElementById(labelName).textContent=' Geben Sie in Numerik Telefax! ';
            Faxtext.focus();
            return false;
        }//end
        else
        {
            return true;
        }     
    }
    else
    {
        return false;
    }
}
//End function

//Function To Validate BenutzerName Form 
function submitBenutzerNameFrm(divName,labelName)
 {
    if((isMandatory2('frmzugangsdaten_endern','txtoldpass','divError','lblErrorMsg'))
    &&(isMandatory2('frmzugangsdaten_endern','txtnewpass','divError','lblErrorMsg'))
    &&(isMandatory2('frmzugangsdaten_endern','txtconpass','divError','lblErrorMsg')))
    {
        return true;
    }
    else
    {
        return false;
    }
}

function submitpwd()
{
if((isMandatory2('frmneukunde','txtnewpwd','divError','lblMsg'))
   &&(isMandatory2('frmneukunde','txtconfirmpwd','divError','lblMsg')))
   {
       if(document.frmneukunde.txtnewpwd.value!=document.frmneukunde.txtconfirmpwd.value)
       {
        //alert("Bitte geben Sie das gﾃｼltige Passwort ein!");
        document.getElementById('divError').style.display='block';
        document.getElementById('lblMsg').innerText='Bitte geben Sie das gﾃｼltige Passwort ein!';
        document.getElementById('lblMsg').textContent='Bitte geben Sie das gﾃｼltige Passwort ein!';
	    //window.document.frmneukunde.txtconfirmpwd.value='';
	    document.getElementById('txtconfirmpwd').value='';
	    return false;
       }
       else
       {
        document.frmneukunde.par_pwd.value='updatepwd';
        document.frmneukunde.submit();
        return true;
       }
       return true;
   }
   else
   {
   return false;
   }
 }
//end function

//This function is used for popupPersonalDetail.aspx
function submitPerData(divName,labelName)
    {
         if ((isMandatory2('frmpopupPersoneldet','txtAddress1','divError','lblMsg'))
         && (isMandatory2('frmpopupPersoneldet','txtPostcode','divError','lblMsg'))
         && (isMandatory2('frmpopupPersoneldet','txtfamilyname','divError','lblMsg'))
         && (isMandatory2('frmpopupPersoneldet','txtCity','divError','lblMsg'))
         && (isMandatory2('frmpopupPersoneldet','drpCountry','divError','lblMsg')))
        {
             var d=window.document.frmpopupPersoneldet["txtDay"].value;
		     var m=window.document.frmpopupPersoneldet["txtMonth"].value;
		     var y=window.document.frmpopupPersoneldet["txtYear"].value;
		     var txtPhone=window.document.frmpopupPersoneldet["txtPhone"];
             var txtFax=window.document.frmpopupPersoneldet["txtFax"];
		     
		     //To check for if txtphone has entered only numbers
            if(isNumeric(txtPhone.value)==false)
            {
                document.getElementById(divName).style.display='block';
	            document.getElementById(labelName).innerText=' Geben Sie in Numerik Telefon! ';
	            document.getElementById(labelName).textContent=' Geben Sie in Numerik Telefon! ';
                txtPhone.focus();
                return false;
            }//end
            
            //To check if txtFax has entered only as numbers
            if(isNumeric(txtFax.value)==false)
            {
                document.getElementById(divName).style.display='block';
	            document.getElementById(labelName).innerText=' Geben Sie in Numerik Telefax! ';
	            document.getElementById(labelName).textContent=' Geben Sie in Numerik Telefax! ';
                txtFax.focus();
                return false;
            }//end
                        
            //Function to check for valid EmailID format
            if(!isValidEmail(document.getElementById('txtEmail').value))
            {
                document.getElementById(divName).style.display='block';
	            document.getElementById(labelName).innerText=' Eingabe Email Adresse! ';
	            document.getElementById(labelName).textContent=' Eingabe Email Adresse! ';
                window.document.frmpopupPersoneldet["txtEmail"].select();
                window.document.frmpopupPersoneldet.htxtsubAct.value=='';
                return false;
            }
            
            if(window.document.frmpopupPersoneldet["txtDay"].value!='' || window.document.frmpopupPersoneldet["txtMonth"].value!='' ||  window.document.frmpopupPersoneldet["txtYear"].value!='')
            {    
               if(!(gtdate(d,m,y)))
               {
                 document.getElementById(divName).style.display='block';
	             document.getElementById(labelName).innerText=' Ungltiges Geburtsdatum! ';
	             document.getElementById(labelName).textContent=' Ungltiges Geburtsdatum! ';
                 window.document.frmpopupPersoneldet["txtDay"].select();
                 window.document.frmpopupPersoneldet.htxtsubAct.value=='';
                 return false;
               }
               else
               {
                 document.getElementById(divName).style.display='none';
	             document.getElementById(labelName).innerText='';
	             document.getElementById(labelName).textContent='';
                 document.frmpopupPersoneldet.htxtsubAct.value="save";
                 window.document.frmpopupPersoneldet.submit();
               }
            }
            // to check out for a valid email address
            else
            {
                document.getElementById(divName).style.display='none';
	            document.getElementById(labelName).innerText='';
	            document.getElementById(labelName).textContent='';
                document.frmpopupPersoneldet.htxtsubAct.value="save";
                window.document.frmpopupPersoneldet.submit();
            }
        }
        else
        {
            return false;
        }
    }
    //end function



    
   function submitSearchDetails(hdn,type)
	{
		
			if (type=='aut')
			{
			//window.document.frmauthor.type.value;
			window.document.forms['frmauthor'].elements['code'].value=hdn;
			//window.document.forms['frmauthor'].action="/SearchManagement/search.aspx";
			window.document.forms['frmauthor'].submit();
			}
			if (type=='pub')
			{
			//window.document.frmpub.type.value;
			window.document.forms['frmpub'].elements['code'].value=hdn;
			//window.document.forms['frmpub'].action="/SearchManagement/search.aspx";
			window.document.forms['frmpub'].submit();
			}
			if (type=='key')
			{
			window.document.forms['frmkey'].elements['code'].value=hdn;			
			window.document.forms['frmkey'].submit();
			}
			
	}
	
	function checkquantity(qty,id,obj_id,ean)
   {
    var strQty = "prd_qty" + id;
    var txtval=document.getElementById(strQty).value;
    if(txtval=="")
    {
    document.getElementById(strQty).focus();
    SetInnerHTMLFromAjaxResponseCart(txtval,id,obj_id,ean);
    //alert("Quantity should not be empty");
    document.getElementById('divError').style.display='block';
	document.getElementById('lblMsg').innerText='Quantity should not be empty';
	document.getElementById('lblMsg').textContent='Quantity should not be empty';
    }
    else
    {
    document.getElementById('divError').style.display='none';
	document.getElementById('lblMsg').innerText="";
	document.getElementById('lblMsg').textContent="";
    }
   
   }


