function doBlink() {
  var blink = document.all.tags("BLINK")
  for (var i=0; i < blink.length; i++)
    blink[i].style.visibility = blink[i].style.visibility == "" ? "hidden" : "" 
}

function startBlink() {
  if (document.all)
    setInterval("doBlink()",1000)
}
window.onload = startBlink;


function isEmail(Ml)
{
  if(!Ml){return true}
  if(Ml.indexOf("@")<=0 || Ml.indexOf("@")==Ml.length-1 || Ml.indexOf(".")<=0 || Ml.indexOf(".")==Ml.length-1 || Ml.indexOf("..")!=-1 || Ml.indexOf("@@")!=-1 || Ml.indexOf("@.")!=-1 || Ml.indexOf(".@")!=-1)
  {
      return false
  }
  else
  {
      return true
  }
}

function Trim (s){return LTrim(RTrim(' '+s));}
function LTrim (s)
{
    if(!s){return '';}
    while(s.charAt(0)==' ')
        s = s.substring(1,s.length);
    return s;
}
//..............

function RTrim (s)
{
    if(!s || s==' '){return '';}
    if (s.length > 1)
    {
        while(s.charAt(s.length-1)==' ')
            s = s.substring(0,s.length-2);
        return s;
    }
}

function makeArray(n) 
{
this.length = n
return this
}
monthNames = new makeArray(12)
monthNames[1] = "January"
monthNames[2] = "February"
monthNames[3] = "March"
monthNames[4] = "April"
monthNames[5] = "May"
monthNames[6] = "June"
monthNames[7] = "July"
monthNames[8] = "August"
monthNames[9] = "September"
monthNames[10] = "October"
monthNames[11] = "November"
monthNames[12] = "December"

dayNames=new makeArray(7)
dayNames[1]="Sunday";
dayNames[2]="Monday";
dayNames[3]="Tuesday";
dayNames[4]="Wednesday";
dayNames[5]="Thursday";
dayNames[6]="Friday";
dayNames[7]="Saturday";
function GetPgSearch(x)
{
 var frm=document.forms['gallery'];
 frm.limit.value=x;
 frm.submit();
}
function sort(x,y)
{
 var frm=document.forms['search'];
 frm.sort.value=x;
 frm.type.value=y;
 frm.search.value=1;
 frm.submit();
}
function dateString(oneDate) 
{
	var theDay = dayNames[oneDate.getDay() + 1]
	var theMonth = monthNames[oneDate.getMonth() + 1]
	var theYear = oneDate.getFullYear()
	return theDay +" "+ theMonth + " " + oneDate.getDate() + ", " + theYear
}

function GetAuctionDtl(x,y)
{
   var frm=document.forms["link"];
   frm.auction_id.value=x
   frm.edit.value=y
   frm.action='ulm_auction_fulldtl.php'
   frm.submit();
}

function GetGalleryPop(x)
{
  var frm = document.forms['link'];
  frm.target='_new'
  frm.action=x;
  frm.submit();
}

function GetPg(x)
{

	var frm = document.forms['link'];
	if(x=='terms.php')
	{
	frm.target='_new'
	}
	frm.action=x;
	frm.submit();
}
function GetPgD(x,y)
{
	var frm = document.forms['link'];
	frm.action=x;
	frm.cat_id=y;
	frm.submit();
}
function GetTips(x)
{  
   
	var frm = document.forms['link'];
	frm.action='article.php';
	frm.option_id.value=x;
	frm.submit();
}
function GetPgSearch(x)
{
   var frm=document.forms['bride'];
   frm.limit.value=x;
   frm.submit();
}

function GetPhoto(x)
{
    var frm = document.forms['link'];
	frm.action='photoalbum_dtl.php';
	frm.wed_id=x;
	frm.submit();

}
function GetDir(x,y)
{
    var frm = document.forms['left'];
	frm.cat_id.value=x;
	frm.cat_name.value=y;
	frm.action='directory.php';
	frm.submit();
}
function GetDir2(x,y,z)
{
    var frm = document.forms['link'];
	frm.cat_id.value=x;
	frm.cat_name.value=y;
	frm.co_state.value=z;
	frm.action='directory.php';
	frm.submit();
}

function GetDirM(x,y)
{
    var frm = document.forms['form1'];
	frm.cat_id.value=x;
	frm.cat_name.value=y;
	frm.action='directory.php';
	frm.submit();
}
function GetPgR(x)
{
	var frm = document.forms['link'];
	if(frm.user_id.value)
	{
		frm.action=x;
		frm.referer.value='';
		frm.submit();
	}
	else if(confirm("This is login restricted section.\n Do you want to login yourself?")==true)
	{
	  frm.action='login.php';
	  frm.referer.value=x;
	  frm.submit();
	}
}
function GetLetter(x)
{
  var frm = document.forms['link'];
  frm.action="photoalbum.php";
  frm.letter.value=x;
  frm.submit();
}
function checkText()
{
	var frm=document.forms["frmMain"];
	if(!frm.user_id.value || frm.user_id.value<=0)
    {
      alert("Sorry !! You have not loged in.\nThis is login restricted section");
	  return false;
    }
    else if(!frm.message_desc.value)
	{
	   alert("You have not entered message");
	   return false;
	}
      frm.submit();
	  return true
}
function Chk(frm)
{
	if(!frm.user_id.value || frm.user_id.value<=0)
    {
     if(confirm("Sorry !! You have not loged in.\nThis is login restricted section"))
     {
	    frm.action='index.php';
	    frm.submit();	
	 }
	  return false;
    }
    return true
 }   
function showval(x)
{
  eval("getValue("+ x +")");
}
function GetSubject(x)
{
    
	var frm=document.forms["link"];
	frm.subject.value=x;
 	frm.action='professors_rating.php'
	frm.submit();
}
function winT()
 {
    var frm=document.forms["frmMain"];
	if(!frm.user_id.value || frm.user_id.value<=0)
    {
      alert("Sorry !! You have not loged in.\nThis is login restricted section");
	  return false;
    }
    else if(!frm.new_board_name.value)
	{
	    alert("You have not enter value");	
	    return false;
    }	
	  return true
 }
function ValidSet(frm)
{
	var txt="";
   
    if(!frm.site_title.value)
	{   
	   txt+="     Site Title should not be blank.\n";
	}
	if(!frm.admin_mail.value)
	{
	   txt+="     Admin Email Address should not be blank.\n";
	}
	if(!frm.meta_keys.value) 
	{
	   txt+="     Meta Keys should not be blank.\n";
	}
	if(!frm.meta_desc.value) 
	{
	   txt+="     Meta Description should not be blank.\n";
 	}
	if(txt)
	{
   	  alert("Sorry!! Following errors has been occured :\n\n"+ txt +"\n     Please Check");
  	  return false
	}
    return true	
}

function ValidCon(frm)
{
    var txt="";
	
	if(!frm.fname.value)
	{
		txt+="     First Name should not be empty.\n"
	}
	if(!frm.lname.value)
	{
		txt+="     Last Name should not be empty.\n"
	}
	if(!Trim(frm.email.value) || !isEmail(frm.email.value))
	{
	   txt+="     Enter valid email address.\n"
       
 	}
	if(!frm.phone.value)
	{
		txt+="     Phone Number should not be empty.\n"
	}
	if(!frm.message.value)
	{
		txt+="     You did not put any Comment.\n"
	}  
   	if(txt)
	{
   		alert("Sorry!! Following errors has been occured :\n\n"+ txt +"\n     Please Check");
  	 	return false
	}
    return true	
}
function ValidPass(frm)
{
    var txt="";   
    if(!frm.pass.value || frm.pass.value.length<4) 
	{
	   txt+="     Password should not be blank or password less than 4 chars.\n"
	}	
 	if(txt)
	{
   		alert("Sorry!! Following errors has been occured :\n\n"+ txt +"\n     Please Check");
  	 	return false
	}
    return true	 

}
function ValidCat(frm)
{
    var txt="";   
    if(!frm.cat_name.value) 
	{
	   txt+="     Category Name should not be blank.\n"
	}	
 	if(txt)
	{
   		alert("Sorry!! Following errors has been occured :\n\n"+ txt +"\n     Please Check");
  	 	return false
	}
    return true	 

}
function ValidSubcat(frm)
{
    var txt="";   
    if(!frm.sub_cat_name.value) 
	{
	   txt+="     Sub Category Name Name should not be blank.\n"
	}	
 	if(txt)
	{
   		alert("Sorry!! Following errors has been occured :\n\n"+ txt +"\n     Please Check");
  	 	return false
	}
    return true	 

}
function ValidEditor(frm)
{
    var txt="";   
    if(!frm.cont_title.value) 
	{
	   txt+="     Title should not be blank.\n"
	}	
 	if(txt)
	{
   		alert("Sorry!! Following errors has been occured :\n\n"+ txt +"\n     Please Check");
  	 	return false
	}
    return true	 

}
function ValidFpass(frm)
{
    var txt="";   
	
    if(!Trim(frm.admin_mail.value) || !isEmail(frm.admin_mail.value))
	{
	   txt+="     Enter valid email address\n"
       
 	}
 	if(txt)
	{
   		alert("Sorry!! Following errors has been occured :\n\n"+ txt +"\n     Please Check");
  	 	return false
	}
    return true	 

}
function ValidAlogin(frm)
{
    var txt="";   
	
    if(!Trim(frm.pass.value))
	{
	   txt+="     Password should not be blank.\n"
       
 	}
 	if(txt)
	{
   		alert("Sorry!! Following errors has been occured :\n\n"+ txt +"\n     Please Check");
  	 	return false
	}
    return true	 

}

function ValidEvent(frm)
{
	var txt="";
   
    if(!frm.eventname.value)
	{   
	   txt+="     Event Name should not be blank.\n";
	}
	if(!frm.eventorg.value)
	{
	   txt+="     Event Organizer should not be blank.\n";
	}
	if(!frm.shortdescription.value) 
	{
	   txt+="     Short Description should not be blank.\n";
	}
	if(!frm.longdescription.value) 
	{
	   txt+="     Long Description should not be blank.\n";
	}
	if(!frm.startdate.value) 
	{
	   txt+="     Start Date should not be blank.\n";
 	}
	if(txt)
	{
   	  alert("Sorry!! Following errors has been occured :\n\n"+ txt +"\n     Please Check");
  	  return false
	}
    return true	
}
function ValidBanner(frm)
{
	var txt="";
   
    if(!frm.size.value)
	{   
	   txt+="     Please select any Banner Size.\n";
	}			
	if(txt)
	{
   	  alert("Sorry!! Following errors has been occured :\n\n"+ txt +"\n     Please Check");
  	  return false
	}
    return true	
}

function ValidchkName(frm)
{
    var txt="";  
	
	if((!frm.username.value) || (frm.username.value =="Nombre"))
	{   
	   txt+="     Name should not be empty.\n";
	}
    if(!Trim(frm.email.value) || !isEmail(frm.email.value))
	{
	   txt+="     Enter valid email address\n"
       
 	}
 	if(txt)
	{
   		alert("Sorry!! Following errors has been occured :\n\n"+ txt +"\n     Please Check");
  	 	return false
	}
    return true	 

}
function Validtellfriend(frm)
{
	var txt="";
   
    if(!frm.sender_name.value) 
	{
	   txt+="     Your Name should not be blank.\n";
	}	
	if(!Trim(frm.sender_email.value) || !isEmail(frm.sender_email.value))
	{
	   txt+="     Enter valid email address\n"
       
 	}
	if(!frm.message.value) 
	{
	   txt+="     Message should not be blank.\n";
	}	
	if(txt)
	{
   	  alert("Sorry!! Following errors has been occured :\n\n"+ txt +"\n     Please Check");
  	  return false
	}
    return true	
}
function isValidCo(frm)
{
	var txt="";
	if(frm.co_name.value=="")
	{
		txt+="     Enter Company Name\n"
	}
	if(frm.co_email.value=="")
	{
		txt+="     Enter Company Name\n"
	}
	if(!frm.contact_name.value)
	{
		txt+="     First Name & Last Name should not be empty\n"
	} 
	if(!frm.contact_email.value || !isEmail(frm.contact_email.value))
	{
		txt+="     Invalid Email Id\n";
	}
	if(!frm.password.value)
	{
		txt+="     Password should not be empty\n";
	}
	if(!(frm.co_desc.value))
	{
		txt+="     Description should not be empty\n"
	}   
	if(!(frm.co_address.value))
	{
		txt+="     Address should not be empty\n"
	}    
	if(!frm.co_state.value)
	{
		txt+="     Enter superb Name\n"
	}
	if(!frm.co_zip.value)
	{
		txt+="     Enter Zip code\n"
	}
	if(!frm.co_phone1.value)
	{
		txt+="     Enter Zip code\n"
	}
	if(frm.term.checked==false)
	{
		txt+="     You did not agree with the tersms & policy\n"
	}  
   	if(txt)
	{
   		alert("Sorry!! Following errors has been occured :\n\n"+ txt +"\n     Please Check");
  	 	return false
	}
    return true	
}
function isValidCoInAdmin(frm)
{
	var txt="";
	if(frm.co_name.value=="")
	{
		txt+="     Enter Company Name\n"
	}
	if(!frm.co_fname.value || !frm.co_lname.value)
	{
		txt+="     First Name & Last Name should not be empty\n"
	} 
	if(!frm.co_email.value || !isEmail(frm.co_email.value))
	{
		txt+="     Invalid Email Id\n";
	}
	if(!frm.password.value)
	{
		txt+="     Password should not be empty\n";
	}
	if(!(frm.co_desc.value))
	{
		txt+="     Description should not be empty\n"
	}   
	if(!(frm.co_address.value))
	{
		txt+="     Address should not be empty\n"
	}    
	if(!frm.co_state.value)
	{
		txt+="     Enter superb Name\n"
	}
	if(!frm.co_zip.value)
	{
		txt+="     Enter Zip code\n"
	}
	
   	if(txt)
	{
   		alert("Sorry!! Following errors has been occured :\n\n"+ txt +"\n     Please Check");
  	 	return false
	}
    return true	
}

function isValidUserRegForm(frm)
{
	var txt="";
	if(frm.username.value=="")
	{
		txt+="     Enter User Id\n"
	}
	if(!frm.password.value)
	{
		txt+="     Password should not be empty\n"
	} 
	if(!frm.email_address.value || !isEmail(frm.email.value))
	{
		txt+="     Invalid Email Id\n";
	}
	if(!frm.role.value)
	{
		txt+="     Password should not be empty\n";
	}
	if(!(frm.fname.value))
	{
		txt+="     First Name should not be empty\n"
	}   
	if(!(frm.lname.value))
	{
		txt+="     Last Name should not be empty\n"
	}    
	if(!frm.city.value)
	{
		txt+="     Enter City Name\n"
	}
	if(!frm.address.value)
	{
		txt+="     Enter Adress\n"
	}
	if(!frm.state.value)
	{
		txt+="     Enter State\n"
	}
	if(!frm.country.value)
	{
		txt+="     Enter Country\n"
	}
	if(!frm.zip.value)
	{
		txt+="     Enter Zip code\n"
	}	
	if(!frm.phone.value)
	{
		txt+="     Enter Phone\n"
	}	
	if(!frm.partner_fname.value)
	{
		txt+="     Partner's First Name should not be empty\n"
	}	
	if(!frm.partner_lname.value)
	{
		txt+="     Partner's last Name should not be empty\n"
	}	
	if(!frm.month2.value || !frm.day2.value || !frm.year2.value)
	{
		txt+="     Enter Your Wedding Date\n"
	}	
	if(!frm.month1.value || !frm.day1.value || !frm.year1.value)
	{
		txt+="     Enter Your Engagement Date\n"
	}	
	if(!frm.source.value)
	{
		txt+="     Fill How Did You Hear About Us?\n"
	}	
	if(!frm.specify.value)
	{
		if(frm.specify.value==12 || frm.specify.value==11)
		{
			txt+="     Specify Other\n"
		}
	}	
	
   	if(txt)
	{
   		alert("Sorry!! Following errors has been occured :\n\n"+ txt +"\n     Please Check");
  	 	return false
	}
    return true	
}

function ValidFeedback(frm)
{
    var txt="";
	if(!frm.fd_by.value)
	{
		txt+="     Name should not be empty\n"
	}	
	if(!frm.email.value || !isEmail(frm.email.value))
	{
	    txt+="     Enter valid email address\n";
    }
	if(!frm.fd_desc.value)
	{
	   	txt+="     Description should not be empty\n";	
	}
	
   	if(txt)
	{
   		alert("Sorry!! Following errors has been occured :\n\n"+ txt +"\n     Please Check");
  	 	return false
	}
    return true	
}

function isValidUserProfileForm(frm)
{
	var txt="";
	if(frm.username.value=="")
	{
		txt+="     Enter User Id\n"
	}
	if(!frm.password.value)
	{
		txt+="     Password should not be empty\n"
	} 
	if(!frm.email.value || !isEmail(frm.email.value))
	{
		txt+="     Invalid Email Id\n";
	}
	if(!frm.role.value)
	{
		txt+="     Role should not be empty\n";
	}
	if(!(frm.fname.value))
	{
		txt+="     First Name should not be empty\n"
	}   
	if(!(frm.lname.value))
	{
		txt+="     Last Name should not be empty\n"
	}    
	if(!frm.city.value)
	{
		txt+="     Enter City Name\n"
	}
	if(!frm.address.value)
	{
		txt+="     Enter Adress\n"
	}
	if(!frm.state.value)
	{
		txt+="     Enter State\n"
	}
	if(!frm.country.value)
	{
		txt+="     Enter Country\n"
	}
	if(!frm.zip.value)
	{
		txt+="     Enter Zip code\n"
	}	
	if(!frm.phone.value)
	{
		txt+="     Enter Phone\n"
	}	
	if(!frm.partner_fname.value)
	{
		txt+="     Partner's First Name should not be empty\n"
	}	
	if(!frm.partner_lname.value)
	{
		txt+="     Partner's last Name should not be empty\n"
	}	
		
	if(!frm.source.value)
	{
		txt+="     Fill How Did You Hear About Us?\n"
	}	
	if(!frm.specify.value)
	{
		if(frm.specify.value==12 || frm.specify.value==11)
		{
			txt+="     Specify Other\n"
		}
	}	
	
   	if(txt)
	{
   		alert("Sorry!! Following errors has been occured :\n\n"+ txt +"\n     Please Check");
  	 	return false
	}
    return true	
}
function isValidloginForm(frm)
{
	var txt="";
	if(frm.username.value=="")
	{
		txt+="     Enter User Id\n"
	}
	if(!frm.password.value)
	{
		txt+="     Password should not be empty\n"
	} 
	   	if(txt)
	{
   		alert("Sorry!! Following errors has been occured :\n\n"+ txt +"\n     Please Check");
  	 	return false
	}
    return true	
}
function isValidAddGuestForm(frm)
{
	var txt="";
	if(frm.guest.value=="")
	{
		txt+="     Enter Your guest name\n"
	}
	if(!frm.partner.value)
	{
		txt+="     Partner's name should not be empty\n"
	} 
	if(!frm.email.value || !isEmail(frm.email.value))
	{
		txt+="     Invalid Email Id\n";
	}
	if(!frm.address.value)
	{
		txt+="     Address should not be empty\n";
	}
	if(!(frm.city.value))
	{
		txt+="     City should not be empty\n"
	}   
	if(!(frm.state.value))
	{
		txt+="     State should not be empty\n"
	}    
	if(!frm.postal.value)
	{
		txt+="     Enter Postal Code\n"
	}
	if(!frm.country.value)
	{
		txt+="     Enter Country\n"
	}
	
	if(!frm.notes.value)
	{
		txt+="     Enter any notes\n"
	}
	if(!frm.gift.value)
	{
		txt+="     Enter presented Gift\n"
	}	
	if(!(frm.RSVP[0].checked || frm.RSVP[1].checked))
	{
		txt+="     Enter RSVP\n"
	}	
	if(!frm.table_no.value)
	{
		txt+="     Table No should not be empty\n"
	}	
	if(txt)
	{
   		alert("Sorry!! Following errors has been occured :\n\n"+ txt +"\n     Please Check");
  	 	return false
	}
    return true	
}
