// 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;
	    //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


//==============

// 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('UngEtige 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('UngEtige 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ä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");
			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 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;
}


//@@<!!!!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 deliveryaddress.aspx 

function submitfrm()
{
if ((isMandatory('frmDlvAddr','txtFamilyName'))
&&(isMandatory('frmDlvAddr','txtAdd1'))
&&(isMandatory('frmDlvAddr','txtPostcode'))
&&(isMandatory('frmDlvAddr','txtCity'))
&&(isMandatory('frmDlvAddr','drpCountry'))
&&(isMandatory('frmDlvAddr','txtFirstName')))
{
document.frmDlvAddr.htxtsubAct.value="Edit";
window.document.frmDlvAddr.submit();
}
}
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";
}
}

// 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()
         {
         
		         if((isMandatory('frmneukunde','txtbenutzer'))
		        &&(isMandatory('frmneukunde','txtpasswort'))
		        &&(isMandatory('frmneukunde','txtpasswortwh'))
		       // &&(isMandatory('frmneukunde','txtFirstName'))
		        &&(isMandatory('frmneukunde','txtFamilyName'))
		        &&(isMandatory('frmneukunde','txtAddr1'))
		        &&(isMandatory('frmneukunde','txtplz_strasse'))
		        &&(isMandatory('frmneukunde','txtort'))
		        &&(isMandatory('frmneukunde','drpLieferland')))
	           {
        	     
		         //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;
                  // Check for valid date       
                    
	   	           // to check out for a valid email address
		            if(!(isValidEmaill('frmneukunde','txtemail',false)))
		             {
		               window.document.frmneukunde["txtemail"].select();
                       window.document.frmneukunde.htxtflag.value=='';
		              }

		            // to check out for a valid email address
		           else if(!(isValidEmaill('frmneukunde','txtbenutzer',false)))
		             {
        		       
		               window.document.frmneukunde["txtbenutzer"].select();
		               window.document.frmneukunde.htxtflag.value=='';
		              }

		           // checking the correct password
		 	        else if(window.document.frmneukunde.txtpasswort.value !=window.document.frmneukunde.txtpasswortwh.value)
		              {
			  	        alert("Bitte geben Sie das gEtige Passwort ein!");
				        window.document.frmneukunde.txtpasswortwh.value='';
			           }
			            else if(document.frmneukunde.txtEmail_Sperre1.checked==true)
			          {
			 		        if((isMandatory('frmneukunde','txtrecFamilyName'))
						        &&(isMandatory('frmneukunde','txtrecAddr1'))
						        &&(isMandatory('frmneukunde','txtrecplz_strasse'))
						        &(isMandatory('frmneukunde','txtrecort')))
						        {
						        document.frmneukunde.htxtflag.value="submit";
						        window.document.frmneukunde.submit();
						        }
			          }  
//			         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)))
//       			        {
//				        alert("UngEtiges Geburtsdatum");
//				         window.document.frmneukunde["txtgebdatum_tag"].select();
//				         window.document.frmneukunde.htxtflag.value=='';
//				         }
//				         else
//				         {
//		   		        document.frmneukunde.htxtflag.value="submit";
//				        window.document.frmneukunde.submit();
//				        }
//			        }
			        else
			           {
			            //assigning to a temporary variable and submiting the form
			            document.frmneukunde.htxtflag.value="submit";
			            window.document.frmneukunde.submit();
			         }	 
	        }
        }
			 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;
		}
		
		function cOn(td)
		{
			if(document.getElementById||(document.all && !(document.getElementById)))
		    {
			    td.style.backgroundColor="#FBF3DF";
		    }
	    }
	    function onOut()
        {
            var email=document.getElementById('txtbenutzer').value;
            document.getElementById('txtemail').innerText=email;
        }

	function cOut(td)
	{		
		if(document.getElementById||(document.all && !(document.getElementById))){
		td.style.backgroundColor="#FFFFFF";
	}
	
	//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");
      }
       
	}
	function largeimage(pcode,domType)
      {
       window.open('LargeImage.aspx?domainType='+domType+'&prdcode='+pcode,'new','toolbar=0,status=0,menubar=0,scrollbars=no,location=no,resizable=no,width=45,height=45,left=350,top=90');
      }	
    function saveorder()
     {
         if(!window.document.frmOrderview.ChckAGB.checked) 
		 {
		    alert('Sie müssen unseren AGBs zustimmen, um Ihre Bestellung abschliessen zu können');
		 }
	     else
		 {
               window.document.frmOrderview.hdnorder.value='save';
               window.document.frmOrderview.imgnext.disabled=true;
               window.document.frmOrderview.submit();
         }
    }
       var popupWindow=null;
       function popWindow(pcode)
        {
            disablePage();
            
          //window.showModalDialog("popup_delivery.aspx?parcode="+pcode,"mywin",'toolbar=0,status=0,menubar=0,scrollbars=yes,resizable=no,width=600,height=300,left=30,top=30');
         var url = "popup_delivery.aspx?parcode="+pcode;
         
         popupWindow = window.open(url,"mywin",'toolbar=0,status=0,menubar=0,scrollbars=no,resizable=no,width=600,height=500,left=400,top=280');
            //popup.focus();
        }
        function popContact(pcode)
        {
            disablePage();
            //window.showModalDialog("popup_personaldet.aspx?parcode="+pcode,"mywin2",'toolbar=0,status=0,menubar=0,scrollbars=yes,resizable=no,width=600,height=300,left=30,top=30');
            var url="popup_personaldet.aspx?parcode="+pcode;
            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();
        }
        window.onload = function() 
        {	
              window.name = "OrderOverview.aspx";
        }
	
	
	//The following functions are used for PersonalDetails.aspx
	
    function submitPerData()
    {
        if ((isMandatory('frmPersonalData','txtAddress1'))
         &&(isMandatory('frmPersonalData','txtPostcode'))
         &&(isMandatory('frmPersonalData','txtCity'))
         &&(isMandatory('frmPersonalData','drpCountry')))
        {
         var d=window.document.frmPersonalData["txtDay"].value;
         var m=window.document.frmPersonalData["txtMonth"].value;
         var y=window.document.frmPersonalData["txtYear"].value;
           if(window.document.frmPersonalData["txtDay"].value!='' || window.document.frmPersonalData["txtMonth"].value!='' ||  window.document.frmPersonalData["txtYear"].value!='')
           {    
             if(!(gtdate(d,m,y)))
               {
                 alert("Ungültiges Geburtsdatum");
                 window.document.frmPersonalData["txtDay"].select();
                 window.document.frmPersonalData.htxtsubAct.value=='';
               }
              else if(!(isValidEmaill('frmPersonalData','txtEmail',false)))
               {
                 window.document.frmPersonalData["txtEmail"].select();
                 window.document.frmPersonalData.htxtsubAct.value=='';
               }
               else
               {
                 document.frmPersonalData.htxtsubAct.value="save";
                 window.document.frmPersonalData.submit();
               }
          }
            // to check out for a valid email address
          else
          {
            document.frmPersonalData.htxtsubAct.value="save";
            window.document.frmPersonalData.submit();
          }
        }
   }
    
}
function submit()
  { 
    window.document.frmprofisearchbuch.submit();     
  }
  
  function submitOrderBy(url)
  {
      if (url!="")
       window.document.frmPrdSearch1.action=url;
       window.document.frmPrdSearch1.submit();
       //window.location="DomainSearch.aspx?sort=sortsearch";
  }
  
  function submitlang(url)
  {
   if (url!="")
    window.document.frmPrdSearch1.action=url;
    window.document.frmPrdSearch1.submit();
    
  }
  
  function submitreset()
  {
	window.document.frmPrdSearch1.txtsucheapp.value=""
	window.document.frmPrdSearch1.cboOrdBy.value=0
	window.document.frmPrdSearch1.txtkprnoti.value=0
	window.document.frmPrdSearch1.drplang.value=0
	window.document.frmPrdSearch1.drprubrik.value=0
	window.document.frmPrdSearch1.drpprice.value=0
    window.document.frmPrdSearch1.submit();
  }
