
var tim=0
var t
var arry=new Array()
var arrymsg=new Array()
dummydivflag=0 //need to resize the textbox in message compose

function initialize()
{
	arry[0]="What is LooQal?";
        arrymsg[0]="LooQal is an online community designed to help you keep your family and friends updated. Unlike tradition blogging websites LooQal aims to a build a platform focused on and around the happenings of websites, the various services you receive through the day."
	arry[1]="Why LooQal?";
        arrymsg[1]="We receive all kinds of services everyday. By sharing these experiences, your friends and family will stay do time your comments will generate in the loop on what you do. At the same time, we believe the collection of an anonymous yet helpful referral system that can transform the way we seek out our next favorite restaurant, the most reliable mechanics, the coolest DJ in town. well you get the idea."
	arry[2]="How: Message 3";
        arrymsg[2]="no info yet..will fill laterz"
	animessage();
}
////////////////////////////////////////////////////////////////////////
function getregfix()
{
  // alert(document.getElementById("regsection").clientHeight)
  // document.getElementById("regsection").style.marginLeft="10px"
  // alert("hi");
 document.getElementById("regsection").lineHeight="1.2"
}
////////////////////////////////////////////////////////////////////////
function countryvalue(obj)
{
    if(obj.value>0)
	window.location="/findlocation/" + obj.value
}
////////////////////////////////////////////////////////////////////////////////
function set_cookie(objvalue)
{
    var date = new Date();

    var flag=getCookie('locationdet')
      if(flag!=null && flag!="")  
      {
       date.setTime(date.getTime()+(-1*24*60*60*1000));
       var expires = "; expires=" + date.toGMTString();      
         document.cookie = 'locationdet' + "=" + "0" + expires;       
      }
      else 
      {
       date.setTime(date.getTime()+(1*24*60*60*1000));
       var expires = "; expires=" + date.toGMTString();
       document.cookie = 'locationdet' + "=" + objvalue
      } 
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1 ;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length
    return unescape(document.cookie.substring(c_start,c_end));
    } 
  }
return ""
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////
function check_loc()
{
  setTimeout('timerlag()',2000)	
}
///////////////////////////////////////////////////////////////////////////////
function timerlag()
{
   var updajax=new Ajax.Updater('changewords', '/checklocation', {asynchronous:true, evalScripts:true, frequency: 0.01})	
}
/////////////////////////////////////////////////////////////////////////////////
function forgetmail()
{
   filup=document.getElementById("emailer")
   str="<div id=\"emailname\">Your Email</div>"
   str=str + " <input id=\"emaid\" type=\"text\" name=\"emailer\" value=\"\" /> "
   str=str + " <input id=\"emaidbut\" type=\"submit\" value=\"Send\" onclick=\"reset()\" />"
   filup.innerHTML=str
	temp=document.getElementById("outerwrap");
    tempbox=document.getElementById("emailbox")
    tempbox.style.display="block"
	tempbox.style.left=temp.offsetLeft + "px"
    tempbox.style.top=temp.offsetTop + "px"
	tempbox.style.width="" + temp.clientWidth + "px"
	tempbox.style.height="" + temp.clientHeight + "px"	


}
/////////////////////////////////////////////////////////////////////////////////
function check4name()
{
  fname=document.getElementById("fnm").value;
  lname=document.getElementById("lnm").value;

  fname=fname.replace(/ /g,"")
  lname=lname.replace(/ /g,"")

  if(fname.length>0 && lname.length>0)
  {
      return true;
  }
  else
  {
      if(fname.length==0)
       alert("first name missing")
      else
       alert("last name missing")

      return false;    
  }
}
/////////////////////////////////////////////////////////////////////////////////
function closeit(obj)
{
	document.getElementById(obj).style.display="none"
}
/*******************************************************/
function reset()
{

   temp3=document.getElementById("emaid").value;

           check=temp3.indexOf("@")
           if(check > 0)
           {
             if(temp3.lastIndexOf(".") > check && temp3.lastIndexOf(".")!=(temp3.length-1))
              {
                 
                 document.getElementById("emailer").innerHTML="Checking! Please wait as we try to reset...."
                 var updajax=new Ajax.Updater('emailer', '/resetmail?checkon=' + temp3, {asynchronous:true, evalScripts:true, method: 'get', frequency: 0.01})
              }
              else
              {
                 alert("Sorry! The email id isnt in a proper format")
              }
           }
           else
           {
              alert("Sorry! The email id isnt in a proper format")
           }

}
////////////////////////////////////////////////////////////////////////////////
function animessage()
{
         if(tim==3)
         {
            tim=0
         }
		 	
         document.getElementById('msgtitle').innerHTML="" + arry[tim];
         document.getElementById('msgcontent').innerHTML="" + arrymsg[tim]; 
         
         if(tim<3)
          {
              t=setTimeout("animessage()",3000);
			  tim=tim+1
          }

	
}
//////////////////////////////////////////////////////////////////////////////////////////
function timers(name,uid)
{
  setTimeout("mailppl('" + name + "','" + uid + "')",100);
}
/////////////////////////////////////////////////////////////////////////////////////////

function ziptimers(zipval)
{
  setTimeout("zipvalue('" + zipval + "')",100);
}
/////////////////////////////////////////////////////////////////////////////////////////
function locationtimers(city,state)
{
  setTimeout("locationvalue('" + city + "','" + state + "')",100);
}

function locationvalue(city,state)
{
   document.getElementById("lookation").value=""
   document.getElementById("dispblock1").style.display="none"
   document.getElementById("dispblock2").style.display="block"
   document.getElementById("dispblock3").style.display="none"
   document.getElementById("dispblock4").style.display="block"
   cityvalue(city);
   statevalue(state);
   

  // city=document.getElementById("zipcd2").innerHTML
  // state=document.getElementById("zipstate").innerHTML

  bname=document.getElementById("busname").value
  bnm=bname.replace(/ /g,"")
        if(bnm.length>0)
         {
             document.getElementById("streetdetails").style.display="block"
	      var params="city=" + city + "&state=" + state + "&busname=" + bname
	      updajax=new Ajax.Updater('streetdetails', '/lookupstreet', {asynchronous:true, evalScripts:true, parameters:params, method: 'post', frequency: 0.6, onComplete:function(){ setTimeout("resizing()",100);}})
         }
}
///////////////////////////////////////////////////////////////////////////////////////////

function removestreet()
{
       document.getElementById("streetdetails").style.display="none"
}

/////////////////////////////////////////////////////////////////////////////////////////

function addstreet()
{
   temp=document.getElementById("dispblock2")

     if(temp.style.display=="block")
      {
         if(document.getElementById("divcitt").style.display=="block" && document.getElementById("divstat").style.display=="block")
         {
            city=document.getElementById("zipcd2").innerHTML
            state=document.getElementById("zipstate").innerHTML
	     document.getElementById("streetdetails").innerHTML=""
	     document.getElementById("streetdetails").style.display="block"

		  bname=document.getElementById("busname").value
		  bnme=bname.replace(/ /g,"")

		     if(bnme.length==0)
		       bname="a"

	     var params="city=" + city + "&state=" + state + "&busname=" + bname
	     updajax=new Ajax.Updater('streetdetails', '/lookupstreet', {asynchronous:true, evalScripts:true, parameters:params, method: 'post', frequency: 0.6, onComplete:function(){ setTimeout("resizing()",100);}})
         }
      }
}

/////////////////////////////////////////////////////////////////////////////////////////
function fetchqlogvalue()
{
  document.getElementById("blocknum").value=document.getElementById("bloc2").value
  document.getElementById("streetname").value=document.getElementById("street2").value
  document.getElementById("suite").value=document.getElementById("suite2").value
  document.getElementById("neighborhood").value=document.getElementById("neigh2").value
  document.getElementById("county").value=document.getElementById("county2").value
  document.getElementById("ccityy").value=document.getElementById("city2").value
  document.getElementById("sstatee").value=document.getElementById("state2").value
  document.getElementById("zzipcodee").value=document.getElementById("zip2").value
  document.getElementById("weblink").value=document.getElementById("url2").value
  document.getElementById("telenum").value=document.getElementById("telephone2").value
  document.getElementById("valsection").style.display="none"  
  document.getElementById("outerwrap").style.display="block"

  city=document.getElementById("ccityy").value
  state=document.getElementById("sstatee").value
  zip=document.getElementById("zzipcodee").value

  if(zip.length==5)
  {
      zipvalue(zip)
  }
  else
  {
      locationvalue(city,state)
  }
   document.getElementById('footer').style.display="block"
}
/////////////////////////////////////////////////////////////////////////////////////////

function citytimers(city)
{
  setTimeout("cityvalue('" + city + "')",100);
}

function cityvalue(city)
{
  document.getElementById("aDiv").innerHTML=city
  document.getElementById("inputlabel").style.width=(document.getElementById('aDiv').clientWidth + 50) + "px";
  document.getElementById("citi").style.width=(document.getElementById('aDiv').clientWidth + 50) + "px";
  document.getElementById("citi").innerHTML="<div id=\"zipcd2\">" + city + "</div> <div id=\"zipclose\" onclick=\"closecitit()\">x</div>"
  document.getElementById("divcity").style.display="none"
  document.getElementById("divcitt").style.display="block"
}
/////////////////////////////////////////////////////////////////////////////////////////
function statetimers(symb)
{
  setTimeout("statevalue('" + symb + "')",100);
}

function statevalue(symb)
{
  document.getElementById("stat").innerHTML="<div id=\"zipstate\">" + symb + "</div> <div id=\"zipclose\" onclick=\"closestatit()\">x</div>"
  document.getElementById("divstate").style.display="none"
  document.getElementById("divstat").style.display="block"
}
////////////////////////////////////////////////////////////////////////////////////////

function zipvalue(zipcode)
{
  bname=document.getElementById("busname").value
  bnme=bname.replace(/ /g,"")

     if(bnme.length==0)
       bname="a"

   var updajax=new Ajax.Updater('dumy', '/getcitystate?zipval=' + zipcode + "&busname=" + bname, {asynchronous:true, evalScripts:true, method: 'get', frequency: 0.01, onComplete:function(){ setTimeout("resizing()",100);}})
   document.getElementById("divzip").style.display="none"
   document.getElementById("zipdisp").innerHTML="" + "<div id=\"zipcd\">" + zipcode + "</div> <div id=\"zipclose\" onclick=\"closezipit()\">x</div>"
   document.getElementById("divzipbox").style.display="block"
}

function triggerzip()
{
   zipcode=document.getElementById("zipcoder").value
   zipcode=zipcode.replace(/ /g,"")
   if(zipcode.length==5)
   {
     bname=document.getElementById("busname").value
     bnme=bname.replace(/ /g,"")

     if(bnme.length==0)
       bname="a"

     var updajax=new Ajax.Updater('dumy', '/getcitystate?zipval=' + zipcode + "&busname=" + bname, {asynchronous:true, evalScripts:true, method: 'get', frequency: 0.01, onComplete:function(){ setTimeout("resizing()",100);}})
   document.getElementById("divzip").style.display="none"
   document.getElementById("zipdisp").innerHTML="" + "<div id=\"zipcd\">" + zipcode + "</div> <div id=\"zipclose\" onclick=\"closezipit()\">x</div>"
   document.getElementById("divzipbox").style.display="block"
   }
   else
   {
       document.getElementById("zipcoder").value=""
   }
}
////////////////////////////////////////////////////////////////////////////////////////
function closestreetinfo()
{
   document.getElementById("streetdetails").style.display="none"
   setTimeout("resizing()",100);
}
/////////////////////////////////////////////////////////////////////////////////////////
function closezipit()
{
   document.getElementById("divzipbox").style.display="none"
   document.getElementById("zipcoder").value=document.getElementById("zipcd").innerHTML
   document.getElementById("divzip").style.display="block"
   document.getElementById("zipcoder").focus()
}

function closecitit()
{
/*   document.getElementById("divcitt").style.display="none"
   document.getElementById("city").value=document.getElementById("zipcd2").innerHTML
   document.getElementById("divcity").style.display="block"
   document.getElementById("city").focus()*/
      document.getElementById("lookation").value=""

/*   document.getElementById("dispblock1").style.display="block"
   document.getElementById("dispblock2").style.display="none"
   document.getElementById("dispblock3").style.display="block"
   document.getElementById("dispblock4").style.display="none"*/

   setTimeout("resetvalues()",100);
   
}

function closestatit()
{
/*   document.getElementById("divstat").style.display="none"
   document.getElementById("state").value=document.getElementById("zipstate").innerHTML
   document.getElementById("divstate").style.display="block"
   document.getElementById("state").focus()*/
      document.getElementById("lookation").value=""

   document.getElementById("dispblock1").style.display="block"
   document.getElementById("dispblock2").style.display="none"
   document.getElementById("dispblock3").style.display="block"
   document.getElementById("dispblock4").style.display="none"

   setTimeout("resetvalues()",100);

}


function checkvalidity()
{
   temp=document.getElementById("lookation")
   str=temp.value
   tempstr=str.split(",")

  if(document.getElementById("dispblock1").style.display=="block")
  {
    if(tempstr.length==2)
    {
       if(tempstr[0].length>0 && tempstr[1].length>0)
       {
          var updajax=new Ajax.Updater('dumy', '/chkvalidcitate?strg=' + str, {asynchronous:true, evalScripts:true, method: 'get', frequency: 0.01, onComplete:function(){ setTimeout("resizing()",100);}})
       }
    }
    else
     resetvalues()
  }
}
/////////////////////////////////////////////////////////////////////////////////////////

function resetvalues()
{
   document.getElementById("lookation").value=""
   document.getElementById("city").value=""
   document.getElementById("state").value=""

   document.getElementById("streetdetails").style.display="none"
   document.getElementById("divzipbox").style.display="none"
   document.getElementById("zipcoder").value=""
   document.getElementById("divzip").style.display="block"
   document.getElementById("dispblock1").style.display="block"
   document.getElementById("dispblock2").style.display="none"
   document.getElementById("dispblock3").style.display="block"
   document.getElementById("dispblock4").style.display="none"
   //document.getElementById("lookation").focus()
   setTimeout("resizing()",100);
}

////////////////////////////////////////////////////////////////////////////////////////////
function mailppl(name,uid)
{


  flag=checkduplicate(uid);

  if(flag==0)
  { 
    document.getElementById("aDiv").innerHTML=name
   dumdiv=document.getElementById("dummydiv");

   tempp=document.getElementById("cto")
   tempp1=document.getElementById("compcontainer")
   var newdiv = document.createElement('div');
   newdiv.innerHTML="<div class=\"bigaddit\" id=\"addit_" + uid + "\">" + name + "</div><div class=\"smalladdit\" onclick=\"remov(this);\"> x </div>"

   newdiv.setAttribute('style','float:left;padding:2px;padding-bottom:3px;border:solid;border-width:1px;margin:1px 3px 1px 3px')
   newdiv.setAttribute('id','dynam')
   newdiv.style.border="solid"
   newdiv.style.borderWidth="1px"
   newdiv.style.padding="2px"
   newdiv.style.paddingBottom="3px"
   newdiv.style.backgroundColor="rgb(202,233,255)"
   newdiv.style.margin="1px 3px 1px 3px"
   newdiv.style.styleFloat="left"

   newdiv.style.width=(document.getElementById('aDiv').clientWidth + 22) + "px";
   newdiv.style.height=(document.getElementById('aDiv').clientHeight) + "px";

   tempp1.insertBefore(newdiv,dumdiv)
   tempp.value=""

    tempp.style.styleFloat="left"
    tempp.style.marginTop="2px"
   
   browser = navigator.appName
   	
   	if (browser != "Netscape") 
       {
          val=540-dumdiv.offsetLeft
       }
       else
       {
          val=540-(dumdiv.offsetLeft-tempp1.offsetLeft)
       }

       if(val>150)
       {
          tempp.style.width="" + val + "px"
       } 
       else
       {
          tempp.style.width="540px"
       }
  }
  else
  {
   tempp=document.getElementById("cto")
   tempp.value=""
  }
    sizupwrap();
    document.getElementById("aDiv").innerHTML=""
}

/////////////////////////////////////////////////////////////////////////////////////////
/*function mailppl(name,uid)
{


  flag=checkduplicate(uid);

  if(flag==0)
  { 
    document.getElementById("aDiv").innerHTML=name

   tempp=document.getElementById("cto")
   tempp1=document.getElementById("compcontainer")
   var newdiv = document.createElement('div');
   newdiv.setAttribute('class','addit')
   newdiv.setAttribute('id','addit_' + uid)

   var newsmalldiv=document.createElement('div');
   newsmalldiv.innerHTML=name
   newsmalldiv.setAttribute('class','bigaddit')
   newdiv.appendChild(newsmalldiv);

   var newsmalldiv1=document.createElement('div');
   newsmalldiv1.innerHTML=" x "
   newsmalldiv1.setAttribute('class','smalladdit')
   newsmalldiv1["onclick"] = function () {remov(this);};
   newdiv.appendChild(newsmalldiv1);

   tempp1.insertBefore(newdiv,tempp)
   i=sizing()
   tempp.value=""
  
   /////////////IE styling///////////////////////
   browser = navigator.appName
   	
   	if (browser != "Netscape") 
        {
          newdiv.style.width=(document.getElementById('aDiv').clientWidth + 300) + "px";
          newdiv.style.float="left"
          newdiv.style.border="solid";
	   newdiv.style.borderColor="black";
          newdiv.style.padding="1px";
          newdiv.style.paddingLeft="3px";
          newdiv.style.paddingRight="3px";
          newdiv.style.margin="1px";
          newdiv.style.marginLeft="0px";
          newdiv.style.textAlign="left";

          //newsmalldiv.style.float="left"
          newsmalldiv.style.marginLeft="4px";
          newsmalldiv.style.fontSize="8pt";
          newsmalldiv.style.marginTop="1px";
          newsmalldiv.style.textAlign="left";
          //newsmalldiv1.style.float="right"
          newsmalldiv1.style.marginLeft="4px";
          newsmalldiv1.style.fontSize="8pt";
          newsmalldiv1.style.marginTop="1px";
          newsmalldiv1.style.textAlign="left";   

          newsmalldiv1.style.border="solid";
          newsmalldiv.style.border="solid";
          newsmalldiv.style.width=(document.getElementById('aDiv').clientWidth + 5) + "px";
          newsmalldiv1.style.width="20px";

	}
   /////////////IE styling///////////////////////


   //siz=(tempp1.clientWidth-i)

   //  if(siz<40)
   //   tempp.style.width="540px"
   //  else
   //   tempp.style.width=siz + "px"
   //
    tempp.style.width="150px"
    val=tempp.offsetLeft;
    tempp.style.width=(tempp1.clientWidth-val+290) + "px"
  }
  else
  {
   tempp=document.getElementById("cto")
   tempp.value=""
  }
    sizupwrap();

}*/
///////////////////////////////////////////////////////////////////
/*function checkduplicate(uid)
{
  flag=0
   temp=document.getElementById("compcontainer").childNodes

  for(i=0;i<temp.length;i++)
  {
  	chk=temp[i].id.replace("addit_","")
       if(chk==uid)
	  return 1;	     
  }

  return flag;

}*/

function checkduplicate(uid)
{
  flag=0
   temp=document.getElementById("compcontainer").childNodes

  for(i=0;i<temp.length;i++)
  {       
       if(temp[i].id=="dynam")
        {
           objs=temp[i].childNodes
	  	chk=objs[0].id.replace("addit_","")
       	 if(chk==uid)
	  	   return 1;	                
        }

         //alert(temp[i].childNodes.length)      

  }

  return flag;

}
///////////////////////////////////////////////////////////////////
function sizing()
{
   i=0
   temp=document.getElementById("compcontainer").childNodes

  for(i=0;i<temp.length;i++)
  {
  	i = i + temp[i].clientWidth + 10  
  }
  return i;
}
////////////////////////////////////////////////////////////////////
function remov(obj)
{
  nod=obj.parentNode
  tempp2=document.getElementById("compcontainer")
  tempp2.removeChild(nod)

   tempp=document.getElementById("cto")
   tempp1=document.getElementById("compcontainer")


 /*   tempp.style.width="150px"
    val=tempp.offsetLeft;
    tempp.style.width=(tempp1.clientWidth-val+290) + "px" */

dumdiv=document.getElementById("dummydiv");

   browser = navigator.appName
   	
   	if (browser != "Netscape") 
       {
          val=540-dumdiv.offsetLeft
       }
       else
       {
          val=540-(dumdiv.offsetLeft-tempp1.offsetLeft)
       }

       if(val>150)
       {
          tempp.style.width="" + val + "px"
       } 
       else
       {
          tempp.style.width="540px"
       }


    sizupwrap();
}
///////////////////////////////////////////////////////////////////
function togglediv(obj1,obj2)
{
	document.getElementById(obj1).style.display="none"
	document.getElementById(obj2).style.display="block"

   bodytemp=document.getElementById("inputsection");	
   tempp=document.getElementById("outerwrap");   
   tempp.style.height=bodytemp.clientHeight + 120 + "px"	
}

/////////////////////////////////////////////////////////////////////
function showdata(randm)
{
	tempdimref=document.getElementById('outerwrap')

	tempdim=document.getElementById('circle')
       tempdim.style.left=tempdimref.offsetLeft + "px"
       tempdim.style.top=(tempdimref.offsetTop + 20) + "px"

       tempdim.style.width=tempdimref.clientWidth + "px"
       tempdim.style.height="560px"
       tempdimref.style.display="none"
       document.getElementById('footer').style.display="none"
       tempdim.style.display="block"

       var updajax=new Ajax.Updater('dummmy', '/pullbusdata?strg=' + randm, {asynchronous:true, evalScripts:true, method: 'get', frequency: 0.01, onComplete:function(){ setTimeout("checkresizing()",100);}})
}

function newlocation()
{

	document.getElementById("bloc2").value=""
	document.getElementById("street2").value=""
	document.getElementById("suite2").value=""				
	document.getElementById("neigh2").value=""
	document.getElementById("county2").value=""							
	document.getElementById("city2").value=""
	document.getElementById("state2").value=""
	document.getElementById("zip2").value=""
	document.getElementById("url2").value=""
	document.getElementById("telephone2").value=""


	tempdimref=document.getElementById('outerwrap')

	tempdim=document.getElementById('valsection')
       tempdim.style.left=tempdimref.offsetLeft + "px"
       tempdim.style.top=(tempdimref.offsetTop + 20) + "px"

       tempdim.style.width=tempdimref.clientWidth + "px"
       tempdim.style.height="560px"
       tempdimref.style.display="none"
       document.getElementById('footer').style.display="none"
       tempdim.style.display="block"

        try{
             cityy=document.getElementById("zipcd2").innerHTML
           }catch(err){cityy=""}

        try{
             statee=document.getElementById("zipstate").innerHTML
           }catch(err){statee=""}

        try{
             zipp=document.getElementById("zipcd").innerHTML
           }catch(err){zipp=""}

        document.getElementById("city2").value=cityy
        document.getElementById("state2").value=statee
        document.getElementById("zip2").value=zipp

}

function closeqlog()
{
   	document.getElementById('valsection').style.display="none"
       document.getElementById('outerwrap').style.display="block"

}

////////////////////////////////////////////////////////////////////


function getinformation(i)
{
	rdata=document.getElementById("street" + i).value
	document.getElementById("street").value=rdata

	rdata=document.getElementById("zipcode" + i).value
	document.getElementById("zipcode").value=rdata
	
	rdata=document.getElementById("neighborhood" + i).value
	document.getElementById("neighborhood").value=rdata	

	rdata=document.getElementById("url" + i).value
	document.getElementById("website").value=rdata
	
	rdata=document.getElementById("telephone" + i).value
	document.getElementById("telephone").value=rdata
}

///////////////////////////////////////////////////////////////////
function checkplaindata()
{
    subj=document.getElementById("busname").value
    subp=subj.replace(/ /g,"")
    
    if(subp.length==0)
    {
      alert("Error! Subject is empty")
     return false;
    }
    else
     document.getElementById("busdetails").value=subj
    
    document.getElementById("bustags").value=document.getElementById("describe").value

    coment=document.getElementById("comment").value
    subp=coment.replace(/ /g,"")

    if(subp.length==0)
    {
      alert("Error! Content is empty")
      return false;
    }
    else
     document.getElementById("commentss").value=coment
    

    return true
}
//////////////////////////////////////////////////////////////////

function checkalldata()
{

   busname=document.getElementById("busname").value
   bus=busname.replace(/ /g,"")
   if(bus.length>0)
   {
      document.getElementById("busdetails").value=busname
   }
   else
   {
       alert("Error! Need information about Business/service/product")  
       return false;
   }

 city=""
 state=""
 zipcode=""

 try{
      city=document.getElementById("zipcd2").innerHTML
    }catch(err){city=""}

 try{
      state=document.getElementById("zipstate").innerHTML
    }catch(err){state=""}

 try{
      zipcode=document.getElementById("zipcd").innerHTML
    }catch(err){zipcode=""}

    if(zipcode.length>0)
   {
        document.getElementById("ccityy").value=city
        document.getElementById("sstatee").value=state
        document.getElementById("zzipcodee").value=zipcode
   }
   else
    document.getElementById("zzipcodee").value=""

    if(city.length==0 || state.length==0)
     {
       alert("Error! Need information about city and state")  
       return false;
     }
    else
     {
        document.getElementById("sstatee").value=state
        document.getElementById("zzipcodee").value=zipcode
     }
    
    comments=document.getElementById("comment").value
    coms=comments.replace(/ /g,"")

    if(coms.length==0)
    {
       alert("Error! The content section is empty")
       return false     
    }
    else
    {
        document.getElementById("commentss").value=comments
    } 

    street=document.getElementById("streetname").value
    street=street.replace(/ /g,"")

    if(street.length==0)
    {
       alert("Error! Need street name")
       return false     
    }

    tags=document.getElementById("describe").value
    document.getElementById("bustags").value=tags

   return true;
}
///////////////////////////////////////////////////////////////////
function resizing()
{
   bodytemp=document.getElementById("inputsection");	
   tempp=document.getElementById("outerwrap");   
   tempp.style.height=bodytemp.clientHeight + 140 + "px"	
   document.getElementById("body").style.height=(bodytemp.clientHeight + 180) + "px"
}

function checkresizing()
{
   bodytemp=document.getElementById("valsection");	
   tempp=document.getElementById("outerwrap");   
   tempp.style.height=bodytemp.clientHeight + 140 + "px"	
   document.getElementById("body").style.height=(bodytemp.clientHeight + 180) + "px"
}
///////////////////////////////////////////////////////////////////
function switchs(i)
{
	if(i==0)
	{
		document.getElementById("searchbox1").style.display="none";
		document.getElementById("searchbox2").style.display="block";
	}
	else
	{
		document.getElementById("searchbox2").style.display="none";
		document.getElementById("searchbox1").style.display="block";		
	}
}

///////////////////////////////////////////////////////////////////
function checkvalid()
{
	errormessage=""
	
	temp=document.getElementById("username").value

	temp=temp.replace(/ /g,"")
		
	if(temp.length<5)
    {
       errormessage=" Error: Name must have at least 6 letters"  		
	}
	var1=temp.match(/[a-zA-Z0-9]/);
	if(var1)
	 flag=1
	else
	 errormessage=errormessage + "\n Error: Only alphabets and numbers allowed in User name"
		
	temp=document.getElementById("password").value
	temp=temp.replace(/ /g,"")	
	if(temp.length<5)
    {
       errormessage=errormessage + "\n Error: Password must have at least 6 letters"  		
	}

	var1=temp.match(/[a-zA-Z0-9]/);
	if(!var1)
	 errormessage=errormessage + "\n Error: Only alphabets and numbers allowed in Password"
	 
	temp1=document.getElementById("cpassword").value
	temp1=temp1.replace(/ /g,"")	
	if(temp1.length<5)
    {
       errormessage=errormessage + "\n Error: Confirm Password must have at least 6 letters"  		
	}
		
	if(temp.length!=temp1.length)
	{
		errormessage=errormessage + "\n Error: Mis-match of password and confirm password"  		
	}	
		
	temp=document.getElementById("emailid").value
        eminvalid=0
           check=temp.indexOf("@")
           if(check > 0)
           {
             if(temp.lastIndexOf(".") > check && temp.lastIndexOf(".")!=(temp.length-1))
              flag=1;
	      else
              {
	        errormessage=errormessage + "\n Error: Invalid Email id"
                eminvalid=1  		
              }
           }
	   else
           {
              errormessage=errormessage + "\n Error: Invalid Email id"
              eminvalid=1
           }

        temp=document.getElementById("emailchkk").value
         if(eminvalid==0 && temp==0)
          errormessage=errormessage + "\n Error: Email id already exists in the database"

	temp=document.getElementById("zipcode").value
	if(temp.length<5)
	{
		errormessage=errormessage + "\n Error: Invalid Zipcode"  		
	}

	temp=document.getElementById("rulez")
	
	if(document.getElementById("priv").checked)
	{
		temp.value=1
	}
	

	if(temp.value==0)
		errormessage=errormessage + "\n Error: Please accept the Terms of Use and Privacy Policy"  		


    if(errormessage.length > 0) 
	{
		alert(errormessage)
		return false;
	}
	else 
	  return true; 
}

///////////////////////////////////////////////////////////////////
function focusonit()
{
  document.getElementById("regisbutton").disabled=true;
  document.getElementById("availmessage").innerHTML="Enter alphanumeric characters";


   /*	browser = navigator.appName
   	
   	if (browser == "Netscape") 
        {
           document.getElementById("regsection").style.height=(document.getElementById("dummmy").offsetTop + 40 -165) + "px"
   	}
   	else 
        {
           document.getElementById("regsection").style.height=(document.getElementById("dummmy").offsetTop + 40 -52) + "px"
   	}
     */
//  document.getElementById("regsection").style.height=(document.getElementById("dummmy").offsetTop + 40 -165) + "px"
 // alert("size=" + (document.getElementById("dummmy").offsetTop + 40 - 165))
}

/////////////////////////////////////////////////////////////////////
function focusemail()
{
 // document.getElementById("regisbutton").disabled=true;
  document.getElementById("emailmessage").innerHTML="Enter a valid email id";
  document.getElementById("emailmessage").style.color="black"
  //document.getElementById("regsection").style.height=(document.getElementById("dummmy").offsetTop + 40 - 165) + "px"
}
////////////////////////////////////////////////////////////////////

function bluronit()
{

  temp1=document.getElementById("username").value;
  var1=temp1.match(/^[a-zA-Z0-9]+$/);
  
      if(temp1.length>1 && var1)
        {
          //var pars = Form.serialize('reg');
         // temp2=document.getElementById("inviboxes1");
         // temp2.style.display="block"
          document.getElementById("availmessage").innerHTML="Wait! Looking up to check availability"  
          var updajax=new Ajax.Updater('availmessage', '/availname?checkon='+ temp1, {asynchronous:true, evalScripts:true, method: 'get', frequency: 0.01})
        }
      else
        {
          // document.getElementById("inviboxes1").style.display="none"
           document.getElementById("regisbutton").disabled=true;
        }     

     /*   browser = navigator.appName

        if (browser == "Netscape")
        {
           document.getElementById("regsection").style.height=(document.getElementById("dummmy").offsetTop + 40 -165) + "px"
        }
        else
        {
           document.getElementById("regsection").style.height=(document.getElementById("dummmy").offsetTop + 40 -52) + "px"
        }
     */
  // document.getElementById("regsection").style.height=(document.getElementById("dummmy").offsetTop + 40 - 165) + "px"
}

/////////////////////////////////////////////////////////////////////////

function bluremail()
{

  temp1=document.getElementById("emailid").value;

    check=temp1.indexOf("@")
     if(check > 0)
      {
        if(temp1.lastIndexOf(".") > check && temp1.lastIndexOf(".")!=(temp1.length-1))
         {
            var updajax=new Ajax.Updater('dummmy', '/availemail?checkon='+ temp1, {asynchronous:true, evalScripts:true, method: 'get', frequency: 0.01})

         }
	else
         {
          document.getElementById("emailmessage").innerHTML="Error! Invalid email id";
          document.getElementById("emailchkk").value="0"
          document.getElementById("emailmessage").style.color="rgb(192,0,0)"
         }
      }
      else
        {
         document.getElementById("emailmessage").innerHTML="Error! Invalid email id";
         document.getElementById("emailchkk").value="0"
         document.getElementById("emailmessage").style.color="rgb(192,0,0)"
        }
}

//////////////////////////////////////////////////////////////////////
function addmail()
{
  temp3=document.getElementById("ename").value
           check=temp3.indexOf("@")
           if(check > 0)
           {
             if(temp3.lastIndexOf(".") > check && temp3.lastIndexOf(".")!=(temp3.length-1))
              {
                 tempdim=document.getElementById("body")
                 tempcir=document.getElementById("circle")
                
                 tempcir.style.left="0px";
                 tempcir.style.top="0px";
                 tempcir.style.width=tempdim.clientWidth + "px"
                 tempcir.style.height=tempdim.clientHeight + "px" 
                 tempcir.style.display="block"

                 var updajax=new Ajax.Updater('contactsection', '/addemail?values=' + temp3, {asynchronous:true, evalScripts:true, method: 'get', frequency: 0.01})
              }
              else
              {
                 err="error in email id"
              }
           }
           else
           {
                 err="error in email id"
           }

}


////////////////////////////////////////////////////////////////////////
function addmobile()
{
  temp3=document.getElementById("mname").value

           if(temp3.length > 0)
           {
                 tempdim=document.getElementById("body")
                 tempcir=document.getElementById("circle")
                
                 tempcir.style.left="0px";
                 tempcir.style.top="0px";
                 tempcir.style.width=tempdim.clientWidth + "px"
                 tempcir.style.height=tempdim.clientHeight + "px" 
                 tempcir.style.display="block"
                 var updajax=new Ajax.Updater('contactmobsection', '/addmobile?values=' + temp3, {asynchronous:true, evalScripts:true, method: 'get', frequency: 0.01})
           }
           else
           {
                 err="error in email id"
           }

}


////////////////////////////////////////////////////////////////////////
function addsocial()
{
  temp3=document.getElementById("socname").value
  temp4=document.getElementById("userlog").value

           if(temp3.length>0 && temp4.length>0)
           {
                 tempdim=document.getElementById("body")
                 tempcir=document.getElementById("circle")
                
                 tempcir.style.left="0px";
                 tempcir.style.top="0px";
                 tempcir.style.width=tempdim.clientWidth + "px"
                 tempcir.style.height=tempdim.clientHeight + "px" 
                 tempcir.style.display="block"
                 var updajax=new Ajax.Updater('contactsocsection', '/addsocial?social=' + temp3 + '&logname=' + temp4, {asynchronous:true, evalScripts:true, method: 'post', frequency: 0.01})
           }
           else
           {
                 err="error in social"
           }

}


////////////////////////////////////////////////////////////////////////
function addim()
{
  temp3=document.getElementById("imname").value
  temp4=document.getElementById("imlog").value

           if(temp3.length>0 && temp4.length>0)
           {
                 tempdim=document.getElementById("body")
                 tempcir=document.getElementById("circle")
                
                 tempcir.style.left="0px";
                 tempcir.style.top="0px";
                 tempcir.style.width=tempdim.clientWidth + "px"
                 tempcir.style.height=tempdim.clientHeight + "px" 
                 tempcir.style.display="block"
                 var updajax=new Ajax.Updater('contactimsection', '/addim?social=' + temp3 + '&logname=' + temp4, {asynchronous:true, evalScripts:true, method: 'post', frequency: 0.01})
           }
           else
           {
                 err="error in im"
           }

}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////
function removecon(obj,i)
{
                 tempdim=document.getElementById("body")
                 tempcir=document.getElementById("circle")

                 tempcir.style.left="0px";
                 tempcir.style.top="0px";
                 tempcir.style.width=tempdim.clientWidth + "px"
                 tempcir.style.height=tempdim.clientHeight + "px"
                 tempcir.style.display="block"

  if(i==0)
  {
     var updajax=new Ajax.Updater('contactsection', '/removemail?randm=' + obj, {asynchronous:true, evalScripts:true, method: 'get', frequency: 0.01})
  }
  else if(i==1)
  {
     var updajax=new Ajax.Updater('contactmobsection', '/removemobile?randm=' + obj, {asynchronous:true, evalScripts:true, method: 'get', frequency: 0.01})
  }
  else if(i==2)
  {
     var updajax=new Ajax.Updater('contactsocsection', '/removesocial?randm=' + obj, {asynchronous:true, evalScripts:true, method: 'get', frequency: 0.01})
  }
  else
  {
     var updajax=new Ajax.Updater('contactimsection', '/removeim?randm=' + obj, {asynchronous:true, evalScripts:true, method: 'get', frequency: 0.01})
  }
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////

function boxdisp(obj,obj1)
{
  temp="" + document.getElementById(obj).style.display;
  
  if(temp=='none')
  {
   document.getElementById(obj).style.display="block";
   document.getElementById(obj1).src="/images/triangle3.gif"
  }
  else
  { 
   document.getElementById(obj).style.display="none";  
   document.getElementById(obj1).src="/images/triangle2.gif"
  }

  tempor=document.getElementById("outerwrap")
  tempbox=document.getElementById("homemiddle")
  valchk=tempbox.offsetTop + tempbox.clientHeight  

   if(valchk>500)
    tempor.style.height=(tempbox.offsetTop + tempbox.clientHeight + 20) + "px"
}
///////////////////////////////////////////////////////////////////
function openclose(obj,obj1,img)
{
  document.getElementById(obj).style.display="none"
  document.getElementById(obj1).style.display="block"
  document.getElementById(img).src="/images/triangle3.gif"

  tempor=document.getElementById("outerwrap")
  tempbox=document.getElementById("homemiddle")
  valchk=tempbox.offsetTop + tempbox.clientHeight  

   if(valchk>500)
    tempor.style.height=(tempbox.offsetTop + tempbox.clientHeight + 20) + "px"
}
///////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////
function homepage_reset()
{
  tempor=document.getElementById("outerwrap")
  tempbox=document.getElementById("homeright")
  valchk=tempbox.offsetTop + tempbox.clientHeight

   if(valchk>tempor.clientHeight)
    tempor.style.height=(tempbox.offsetTop + tempbox.clientHeight + 10) + "px"
}

////////////////////////////////////////////////////////////////////
function lookemail()
{
   email=document.getElementById("email").value
   email=email.replace(/ /g,"")
   passwd=document.getElementById("passd").value
   passwd=passwd.replace(/ /g,"")


    if(email.length>0 && passwd.length>0)
       {
                 tempdim=document.getElementById("body")
                 tempcir=document.getElementById("circle")

                 tempcir.style.left="0px";
                 tempcir.style.top="0px";
                 tempcir.style.width=tempdim.clientWidth + "px"
                 tempcir.style.height=tempdim.clientHeight + "px"
                 tempcir.style.display="block"

	      var params = Form.serialize($('emailform'));
	      updajax=new Ajax.Updater('friendmiddle', '/lookupemail', {asynchronous:true, evalScripts:true, parameters:params, method: 'post', frequency: 0.6})	      
       }
}

////////////////////////////////////////////////////////////////////
function selinvallid(i,j)
{
  k=parseInt(i)

  indx=document.getElementById("frestatusel").selectedIndex;

  if(j==0)
  {
    for(m=0;m<k;m++)
    {
       document.getElementById("frecheck" + m).checked=true
       document.getElementById("freselect" + m).selectedIndex=indx
    }
  }
  else
  {
    for(m=0;m<k;m++)
    {
       document.getElementById("frecheck" + m).checked=false
       document.getElementById("freselect" + m).selectedIndex=0
       document.getElementById("frestatusel").selectedIndex=0
    }
  }

}
/////////////////////////////////////////////////////////////////////
function resetinv(i)
{
  k=parseInt(i)

    for(m=0;m<k;m++)
    {
       document.getElementById("frecheck" + m).checked=false
       document.getElementById("freselect" + m).selectedIndex=0
    }
}
/////////////////////////////////////////////////////////////////////
function selallid(i,j)
{
  k=parseInt(i)

  if(j==0)
  {
    for(m=0;m<k;m++)
    {
       document.getElementById("frecheck" + m).checked=true
    }
  }
  else
  {
    for(m=0;m<k;m++)
    {
       document.getElementById("frecheck" + m).checked=false
    }
  }

}

/////////////////////////////////////////////////////////////////////

function getpremails(num)
{
  email_str=""
  for(i=0;i<num;i++)
  {
    temp=document.getElementById("frecheck" + i)
       if(temp.checked)
         email_str=email_str + temp.value + "+"
  }
 
     document.getElementById("freemails").value=email_str;
     var params = Form.serialize($('emailidlist'));
     updajax=new Ajax.Updater('friendmiddle', '/invitepremail', {asynchronous:true, evalScripts:true, parameters:params, method: 'post', frequency: 0.6})


     tempdim=document.getElementById("body")
     tempcir=document.getElementById("circle")

     tempcir.style.left="0px";
     tempcir.style.top="0px";
     tempcir.style.width=tempdim.clientWidth + "px"
     tempcir.style.height=tempdim.clientHeight + "px"
     tempcir.style.display="block"
}

//////////////////////////////////////////////////////////////////////

function getallpreinvmail(num)
{
  email_str="" + document.getElementById("filname").value + "#"
  for(i=0;i<num;i++)
  {
    temp=document.getElementById("frecheck" + i)
       if(temp.checked)
        {
          email_str=email_str + temp.value + "~" + document.getElementById("freselect" + i).selectedIndex + "+"
        }
  }
 
     document.getElementById("freemails").value=email_str;
              var params = Form.serialize($('emailidlist'));
              updajax=new Ajax.Updater('friendmiddle', '/sendpreinvites', {asynchronous:true, evalScripts:true, parameters:params, method: 'post', frequency: 0.6})


                 tempdim=document.getElementById("body")
                 tempcir=document.getElementById("circle")

                 tempcir.style.left="0px";
                 tempcir.style.top="0px";
                 tempcir.style.width=tempdim.clientWidth + "px"
                 tempcir.style.height=tempdim.clientHeight + "px"
                 tempcir.style.display="block"

}
///////////////////////////////////////////////////////////////////////
function searchinv2fre(num)
{
  email_str=""
  for(i=0;i<num;i++)
  {
    temp=document.getElementById("frecheck" + i)
       if(temp.checked)
        {
          email_str=email_str + temp.value + "~" + document.getElementById("freselect" + i).selectedIndex + "+"
        }
  }
 
     document.getElementById("freemails").value=email_str;
              var params = Form.serialize($('emailidlist'));
              updajax=new Ajax.Updater('friendmiddle', '/sendaddreq', {asynchronous:true, evalScripts:true, parameters:params, method: 'post', frequency: 0.6})


                 tempdim=document.getElementById("body")
                 tempcir=document.getElementById("circle")

                 tempcir.style.left="0px";
                 tempcir.style.top="0px";
                 tempcir.style.width=tempdim.clientWidth + "px"
                 tempcir.style.height=tempdim.clientHeight + "px"
                 tempcir.style.display="block"


}
///////////////////////////////////////////////////////////////////////

function sendinv2friends(num)
{
  email_str=""
  for(i=0;i<num;i++)
  {
    temp=document.getElementById("frecheck" + i)
       if(temp.checked)
        {
          email_str=email_str + temp.value + "~" + document.getElementById("freselect" + i).selectedIndex + "+"
        }
  }
 
     document.getElementById("freemails").value=email_str;
              var params = Form.serialize($('emailidlist'));
              updajax=new Ajax.Updater('friendmiddle', '/sendinginvitemail', {asynchronous:true, evalScripts:true, parameters:params, method: 'post', frequency: 0.6})


                 tempdim=document.getElementById("body")
                 tempcir=document.getElementById("circle")

                 tempcir.style.left="0px";
                 tempcir.style.top="0px";
                 tempcir.style.width=tempdim.clientWidth + "px"
                 tempcir.style.height=tempdim.clientHeight + "px"
                 tempcir.style.display="block"

}

//////////////////////////////////////////////////////////////////////
function getsearch_name(num)
{
  email_str=""
  for(i=0;i<num;i++)
  {
    temp=document.getElementById("frecheck" + i)
       if(temp.checked)
         email_str=email_str + temp.value + "+"
  }
 
     document.getElementById("freemails").value=email_str;
              var params = Form.serialize($('emailidlist'));
              updajax=new Ajax.Updater('friendmiddle', '/getsearchnames', {asynchronous:true, evalScripts:true, parameters:params, method: 'post', frequency: 0.6})


                 tempdim=document.getElementById("body")
                 tempcir=document.getElementById("circle")

                 tempcir.style.left="0px";
                 tempcir.style.top="0px";
                 tempcir.style.width=tempdim.clientWidth + "px"
                 tempcir.style.height=tempdim.clientHeight + "px"
                 tempcir.style.display="block"

}

/////////////////////////////////////////////////////////////////////

function getallemails(num)
{
  email_str=""
  for(i=0;i<num;i++)
  {
    temp=document.getElementById("frecheck" + i)
       if(temp.checked)
         email_str=email_str + temp.value + "+"
  }
 
     document.getElementById("freemails").value=email_str;
              var params = Form.serialize($('emailidlist'));
              updajax=new Ajax.Updater('friendmiddle', '/invitemail', {asynchronous:true, evalScripts:true, parameters:params, method: 'post', frequency: 0.6})


                 tempdim=document.getElementById("body")
                 tempcir=document.getElementById("circle")

                 tempcir.style.left="0px";
                 tempcir.style.top="0px";
                 tempcir.style.width=tempdim.clientWidth + "px"
                 tempcir.style.height=tempdim.clientHeight + "px"
                 tempcir.style.display="block"
 }

/////////////////////////////////////////////////////////////////////

function searchbylocat()
{

       ttempo=document.getElementById("keyword").value;
       ttempo=ttempo.replace(/ /g,"")
         
       if(ttempo.length>3)
       {
              var params = Form.serialize($('namesearch'));
              updajax=new Ajax.Updater('friendmiddle', '/searchname', {asynchronous:true, evalScripts:true, parameters:params, method: 'post', frequency: 0.6})


                 tempdim=document.getElementById("body")
                 tempcir=document.getElementById("circle")

                 tempcir.style.left="0px";
                 tempcir.style.top="0px";
                 tempcir.style.width=tempdim.clientWidth + "px"
                 tempcir.style.height=tempdim.clientHeight + "px"
                 tempcir.style.display="block"
       }
       else
       {
           alert("Need atleast 3 characters to search");
       }
}

//////////////////////////////////////////////////////////////////////

function invitenotfriends(str,typ)
{
  var params = "filname=" + str + "&type=" + typ
  updajax=new Ajax.Updater('friendmiddle', '/invifriends', {asynchronous:true, evalScripts:true, parameters:params, method: 'get', frequency: 0.6})
}

function invrestfriends(str)
{
  var params = "filname=" + str
  updajax=new Ajax.Updater('friendmiddle', '/inviothfriends', {asynchronous:true, evalScripts:true, parameters:params, method: 'get', frequency: 0.6})
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function checkinfo()
{
  temp=document.getElementById("country").selectedIndex;
  tempzip=document.getElementById("zipname").value.replace(/ /g,"")
  
  
    if(temp==223)
     {
     
           if(tempzip.length<=0 || tempzip.length>5)
           {
		 alert("Error! Incorrect Zipcode");
		 return false;           
           }
      }     
           
	   flag=0
	   day = parseInt(document.getElementById("date").value);
	   month = parseInt(document.getElementById("month").value);
	   year = parseInt(document.getElementById("year").value);


	     if (month < 1 || month > 12) 
	      {
		 alert("Error! Incorrect month input");
		 return false;
	      }

	     if (day < 1 || day > 31) 
	      {
		 alert("Error! Incorrect date input");
		 return false;
	      }

	      if ((month==4 || month==6 || month==9 || month==11) && day==31) 
	      {
		 alert("Error! Incorrect date input");
		 return false;
	      }

	      if (month == 2) 
	       { 
		var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
		 if (day > 29 || (day==29 && !isleap)) 
		  {
		     alert("Error! Incorrect date input");
		     return false;
		  }
	       }

		   var myDate=new Date();
		   var cdate=new Date();
		   myDate.setFullYear(year,(month-1),(day));

		   year_diff=cdate.getFullYear()-myDate.getFullYear();
                     
                     if(year_diff<13)
                     {
			   alert("Error! Need to be older than 13 years to use LooQal");
			   return false;                     
                     }
                     
		     if(year_diff==13)
		     {
		       month_diff=cdate.getMonth()-myDate.getMonth();  
			if(month_diff<0)
			 {
			   alert("Error! Need to be older than 13 years to use LooQal");
			   return false;
			 }
			if(month_diff==0)
			{
			   day_diff=cdate.getDate()-myDate.getDate();
			    if(day_diff<=0)
			     {
				alert("Error! Need to be older than 13 years to use LooQal");
				return false;
			     }
			}
		     
             return true;

       }

}
////////////////////////////////////////////////////////////////////////////////////////////
function getalluids()
{
   retstr=""
   temp=document.getElementById("compcontainer").childNodes

  for(i=0;i<temp.length;i++)
  {
     if(temp[i].id=="dynam")
     {
         objs=temp[i].childNodes

     	  chk=objs[0].id.replace("addit_","")
         retstr=retstr + chk + ","	     
         
     }
   
  }

  return retstr;
}
////////////////////////////////////////////////////////////////////////////////////////////
function sendcompose()
{
     uids=getalluids()
     tempval=document.getElementById("cmsg").value
     tempsubj=document.getElementById("csub").value

       if(tempval.length>0 && uids.length>0 && tempval.length<1000 && tempsubj.length<100)
        {
             document.getElementById("ppluids").value=uids
	      var params = Form.serialize($('comp'));
	      //updajax=new Ajax.Updater('compbox', '/sendmessages', {asynchronous:true, evalScripts:true, parameters:params, method: 'post', frequency: 0.6})	      
             updajax=new Ajax.Updater('outerwrap', '/sendmessages', {asynchronous:true, evalScripts:true, parameters:params, method: 'post', frequency: 0.6, onComplete:function(){ sizupwrap();}})	      

        }
       else
       {
            if(uids.length==0)
             alert("Error! The To field is missing")
            else if(tempval.length==0)
             alert("Error! Body of message is empty")
            else if(tempval.length>999)
             alert("Error! Body of message is over the limit of 1000 characters")
            else 
             alert("Error! Subject line is over the limit of 100 characters")
       } 
}
//////////////////////////////////////////////////////////////////////////////////////////////
function sendnext()
{
        tempval=document.getElementById("cmsg").value

        if(tempval.length>0 && tempval.length<1000)
         {
	      var params = Form.serialize($('comp'));	      
             updajax=new Ajax.Updater('outerwrap', '/sendnextmessages', {asynchronous:true, evalScripts:true, parameters:params, method: 'post', frequency: 0.6, onComplete:function(){ sizupwrap();}})
         }
       else
       {
            if(tempval.length==0)
             alert("Error! Body of message is empty")
            else
             alert("Error! Body of message is over the limit of 1000 characters")
       } 

}
/////////////////////////////////////////////////////////////////////////////////////////////////
function cancelnext()
{
  document.getElementById("cmsg").value=""
}
//////////////////////////////////////////////////////////////////////////////////////////////
function clrbox()
{
  document.getElementById("cto").value=""
}
/////////////////////////////////////////////////////////////////////////////////////////////
function cancelcompose()
{
  document.getElementById("csub").value=""
  document.getElementById("cmsg").value=""
  prnt=document.getElementById("compcontainer")
   temp=document.getElementById("compcontainer").childNodes

   while (prnt.hasChildNodes())
   {
     if(prnt.firstChild.id=="dummydiv" || prnt.firstChild.id=="cto")
       break;
 
     prnt.removeChild(prnt.firstChild)
   }

   document.getElementById("cto").style.width="540px"
   document.getElementById("cto").focus();
}
////////////////////////////////////////////////////////////////////////////////////////////////////
function sizupwrap()
{
  document.getElementById("outerwrap").style.height=(document.getElementById("compbox").clientHeight + document.getElementById("compbox").offsetTop) + "px"
}
//////////////////////////////////////////////////////////////////////////////
function entercompose()
{
   document.getElementById("cto").focus();
}
/////////////////////////////////////////////////////////////////////////////

function resizupwrap()
{
            tempbox1=document.getElementById("outerwrap")
            boxx=document.getElementById("compbox").clientHeight 
            var tt= boxx + 130
             if(tt>580)
              tempbox1.style.height=(document.getElementById("compbox").clientHeight + 130) + "px" 
             if(boxx<400)     
              document.getElementById("compbox").style.height="400px"

               tempbox1.style.display="block"
          document.getElementById("circle").style.display="none"
}
/////////////////////////////////////////////////////////////////////////////
function actmsg()
{ 
   tempt=document.getElementById("freall")
   i=document.getElementById("frestatusel").selectedIndex
    if(i==0 || i==2)
    {
     tempt.style.display="none"
     selallcheck(0); 
    }
    else
    {
      tempt.style.display="block"
      selallcheck(1);
    }
}
/////////////////////////////////////////////////////////////////////////////////////////////
function selallcheck(indx)
{
  tag=document.getElementsByTagName("input")
  
   for(i=0;i<tag.length;i++)
    {
        if(indx==1)
        {
       	if(tag[i].type=="checkbox")
        	{ 
          		tag[i].checked=true
       	}
        }
        else
        {
       	if(tag[i].type=="checkbox")
        	{ 
          		tag[i].checked=false
       	}
        }
    }   
}

////////////////////////////////////////////////////////////////////////////////////////////////////
function unreadall(j)
{
  tag=document.getElementsByTagName("input")
   str="frecheck_" + j
   for(i=0;i<tag.length;i++)
    {
       	if(tag[i].type=="checkbox")
        	{ 
          		tag[i].checked=false
       	}
    }   
  
   for(i=0;i<tag.length;i++)
    {
       	if(tag[i].id==str)
        	{ 
          		tag[i].checked=true
       	}
    }   
}
////////////////////////////////////////////////////////////////////////////////////////////////////

function inboxactmsg()
{
   tempt=document.getElementById("freall")
   i=document.getElementById("frestatusel").selectedIndex
    if(i==0 || i==4)
    {
     tempt.style.display="none" 
    }
    else
    {
      tempt.style.display="block"
      //selallcheck(1);
    }

     if(i==1)
      unreadall(0) 
     else if(i==2)
      unreadall(1)
     else if(i==3)
      selallcheck(1);
     else
      selallcheck(0);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
function delsentmsg()
{
  tag=document.getElementsByTagName("input")
  listall=""
   for(i=0;i<tag.length;i++)
    {
       	if(tag[i].checked==true)
        	{ 
          		listall=listall + tag[i].value + ","
       	}
    }

        if(listall.length>0)
         {   
             document.getElementById("delones").value=listall;
             circ=document.getElementById("circle")
             refobj=document.getElementById("outerwrap")
             circ.style.left=refobj.offsetLeft + "px";              
             circ.style.top=refobj.offsetTop + "px";
             circ.style.width=refobj.clientWidth + "px";
             circ.style.height=refobj.clientHeight + "px";
             refobj.style.display="none"
             circ.style.display="block"

              var params = Form.serialize($('delmess'));
              updajax=new Ajax.Updater('outerwrap', '/deletebulkmesginbox', {asynchronous:true, evalScripts:true, parameters:params, method: 'post', frequency: 0.6, onComplete:function(){ resizupwrap();}})
          }
         else
         {
             document.getElementById("frestatusel").selectedIndex="0"
             document.getElementById("freall").style.display="none"
         }

}
////////////////////////////////////////////////////////////////////////////////////////////////////
function delmsg()
{
  tag=document.getElementsByTagName("input")
  listall=""
   for(i=0;i<tag.length;i++)
    {
       	if(tag[i].checked==true)
        	{ 
          		listall=listall + tag[i].value + ","
       	}
    }

        if(listall.length>0)
         {   
             document.getElementById("delones").value=listall;
             circ=document.getElementById("circle")
             refobj=document.getElementById("outerwrap")
             circ.style.left=refobj.offsetLeft + "px";              
             circ.style.top=refobj.offsetTop + "px";
             circ.style.width=refobj.clientWidth + "px";
             circ.style.height=refobj.clientHeight + "px";
             refobj.style.display="none"
             circ.style.display="block"

              var params = Form.serialize($('delmess'));
              updajax=new Ajax.Updater('outerwrap', '/deletebulkmesgsent', {asynchronous:true, evalScripts:true, parameters:params, method: 'post', frequency: 0.6, onComplete:function(){ resizupwrap();}})
          }
         else
         {
             document.getElementById("frestatusel").selectedIndex="0"
             document.getElementById("freall").style.display="none"
         }
}