// JScript File
var XmlHttp;
var is_ie = (navigator.userAgent.indexOf('MSIE') >= 0) ? 1 : 0; 
var is_ie5 = (navigator.appVersion.indexOf("MSIE 5.5")!=-1) ? 1 : 0; 
var is_opera = ((navigator.userAgent.indexOf("Opera6")!=-1)||(navigator.userAgent.indexOf("Opera/6")!=-1)) ? 1 : 0; 
//netscape, safari, mozilla behave the same??? 
var is_Mozila = (navigator.userAgent.indexOf('Netscape') >= 0) ? 1 : 0;
function CreateXmlHttp(){
	//Creating object of XMLHTTP in IE
	try	{XmlHttp = new ActiveXObject("Msxml2.XMLHTTP");	}
	catch(e){try{XmlHttp = new ActiveXObject("Microsoft.XMLHTTP");} catch(oc){XmlHttp = null;}}
	//Creating object of XMLHTTP in Mozilla and Safari 
	if(!XmlHttp && typeof XMLHttpRequest != "undefined") {XmlHttp = new XMLHttpRequest();}
}
//******************************** New Share Link Coding ***********************
//******************************************************************************
//function DispDiv()
//{
//    var Url;
//    Url = '../js/ajax/sharelinks.aspx?ChkSession=yes';
//     if(is_ie)
//       {
//            CreateXmlHttp();	
//                if(XmlHttp)	{
//                XmlHttp.onreadystatechange = SessionResponse;	
//                XmlHttp.open("POST", Url,  true);	
//                XmlHttp.send(null);	}
//       }
//       else
//       {
//            CreateXmlHttp();	
//                if(XmlHttp)	{
//                XmlHttp.onreadystatechange = SessionResponse;	
//                XmlHttp.open("GET", Url,  true);	
//                XmlHttp.send(null);	}
//       } 
//}
//function SessionResponse()
//{
//    if(XmlHttp.readyState == 4 && XmlHttp.status == 200)
//     {
//        if(XmlHttp.responseText == 'Oops you are not Logged In!')
//        {
////            if(confirm(XmlHttp.responseText + '\t Do you want to login'))
////                location.href = '../login.aspx';
//            document.getElementById('divAlert').style.visibility = 'visible';
//            document.getElementById('divAlert').style.display = 'block';
//            document.getElementById('divAlert').style.top=350;
//            document.getElementById('divAlert').style.left = 450;
//            document.getElementById('ctl00_ContentPlaceHolder1_lblAlert').innerHTML=XmlHttp.responseText + '\t Do you want to login?';
//        }
//        if(XmlHttp.responseText == 'Exists')
//        {
//           
//            document.getElementById('layer').style.visibility = 'visible';
//            document.getElementById('layer').style.display = 'block';
//            document.getElementById('layer').style.top=350;
//            document.getElementById('layer').style.left = 200;
//            document.getElementById('txtemails').value='';
//            document.getElementById('txtemails').focus();
//            CreateFriendList('tdFriendList' , 'txtemails');
//        }
//     }   
//}
//var GetFlashIDflashid;
function DispDiv()
{
if(doSub())
{
        var Url;
        Url = '../js/ajax/sharelinks.aspx?ChkSession=yes';
         if(is_ie)
           {
                CreateXmlHttp();	
                    if(XmlHttp)	{
                    XmlHttp.onreadystatechange = SessionResponse1;	
                    XmlHttp.open("POST", Url,  true);	
                    XmlHttp.send(null);	}
           }
           else
           {
                CreateXmlHttp();	
                    if(XmlHttp)	{
                    XmlHttp.onreadystatechange = SessionResponse1;	
                    XmlHttp.open("GET", Url,  true);	
                    XmlHttp.send(null);	}
           } 
}
else
{
          window.location.href='../login.aspx';
}
}
function SessionResponse1()
{
    if(XmlHttp.readyState == 4 && XmlHttp.status == 200)
     {
        if(XmlHttp.responseText == 'Oops you are not Logged In!')
        {
//            if(confirm(XmlHttp.responseText + '\t Do you want to login'))
//                location.href = '../login.aspx';
            //flashid.style.visibility='hidden';
            document.getElementById('d1').style.height=document.body.clientHeight + 'px';
            document.getElementById('d1').style.width=document.body.clientWidth + 'px';
            document.getElementById('divAlert').style.visibility = 'visible';
            document.getElementById('divAlert').style.display = 'block';
            document.getElementById('divAlert').style.top=350;
            document.getElementById('divAlert').style.left = 450;
            document.getElementById('ctl00_ContentPlaceHolder1_lblAlert').innerHTML=XmlHttp.responseText + '\t Login to continue';
            document.getElementById('d1').style.visibility='visible'; 
        }
        if(XmlHttp.responseText == 'Exists')
        { 
            //alert('hello');
            //alert(flashid);
            //flashid.style.visibility='hidden';
            document.getElementById('d1').style.height=document.body.clientHeight + 'px';
            document.getElementById('d1').style.width=document.body.clientWidth + 'px';
            document.getElementById('layer').style.visibility = 'visible';
            document.getElementById('layer').style.display = 'block';
            document.getElementById('layer').style.top=350;
            document.getElementById('layer').style.left = 200;
            document.getElementById('d1').style.visibility='visible'; 
            document.getElementById('txtemails').value='';
            //document.getElementById('txtMessage').value='Hi,\n\n I would like to share one of the photographs that they have featured on BlocBuzz with you.\n\nYou can see it here: \n\nWe hope you enjoy it!';
            document.getElementById('txtemails').focus();
            CreateFriendList('tdFriendList' , 'txtemails');
        }
     }   
}
function DispIndexDiv()
{
    var Url;
    Url = 'js/ajax/sharelinks.aspx?ChkSession=yes';
     if(is_ie)
       {
            CreateXmlHttp();	
                if(XmlHttp)	{
                XmlHttp.onreadystatechange = IndexSessionResponse;	
                XmlHttp.open("POST", Url,  true);	
                XmlHttp.send(null);	}
       }
       else
       {
            CreateXmlHttp();	
                if(XmlHttp)	{
                XmlHttp.onreadystatechange = IndexSessionResponse;	
                XmlHttp.open("GET", Url,  true);	
                XmlHttp.send(null);	}
       } 
}
function IndexSessionResponse()
{
    
    if(XmlHttp.readyState == 4 && XmlHttp.status == 200)
     {
        if(XmlHttp.responseText == 'Oops you are not Logged In!')
        {
            document.getElementById('d1').style.height=document.body.clientHeight + 'px';
            document.getElementById('d1').style.width=document.body.clientWidth + 'px';
            document.getElementById('d1').style.visibility="visible"; 
            document.getElementById('popup').style.visibility = 'visible';
            document.getElementById('popup').style.display = 'block';
            document.getElementById('popup').style.top=350;
            document.getElementById('popup').style.left = 450;
            document.getElementById('ctl00_ContentPlaceHolder2_lblAlert').innerHTML=XmlHttp.responseText + '\t Login to continue';
        }
        if(XmlHttp.responseText == 'Exists')
        {
            document.getElementById('d1').style.height=document.body.clientHeight + 'px';
            document.getElementById('d1').style.width=document.body.clientWidth + 'px';
            document.getElementById('d1').style.visibility="visible"; 
            document.getElementById('layer').style.visibility = 'visible';
            document.getElementById('layer').style.display = 'block';
            document.getElementById('layer').style.top=350;
            document.getElementById('layer').style.left = 200;
            document.getElementById('txtemails').value='';
            document.getElementById('txtemails').focus();
            CreateIndexFriendList('tdFriendList' , 'txtemails');
        }
     }   
}
function HideDiv()
{
    //alert(flashid);
    document.getElementById('layer').style.visibility = 'hidden';
    document.getElementById('layer').style.display = 'none';
    document.getElementById('d1').style.visibility='hidden';    
}
function MailSending(emails, subject, Message, From, fromwhere)
{
    var objURL = new Object();
    var UserId = 0;
    var ImageId = 0;
    var VideoId =0;
    var CatId=0;
    var CHId=0;
    var MotId =0;
    var sharetype='';
    window.location.search.replace(new RegExp( "([^?=&]+)(=([^&]*))?", "g" ),function( $0, $1, $2, $3 ){objURL[ $1 ] = $3;});
    for (var strKey in objURL){
        if(strKey == "UId")
        {
            UserId = objURL[ strKey ];
        }  
        if(strKey == "ImageId")
        {
            ImageId = objURL[ strKey ];
        } 
         if(strKey == "VideoId")
        {
            VideoId = objURL[ strKey ];
        } 
        if(strKey == "CatId")
        {
            CatId = objURL[ strKey ];
        }
        if(strKey == "ImageId")
        {
            sharetype='image';
        }
        if(strKey == "VideoId")
        {
            sharetype='video';
        }  
         if(strKey == "CHId")
        {
            CHId=objURL[ strKey ];
        } 
        if(strKey == "MotId")
        {
            MotId=objURL[ strKey ];
        }   
    }
        var Url;
        if (fromwhere==0)
            Url = 'js/ajax/sharelinks.aspx?_SendNewMail=yes&UId=' + UserId + '&type=' + fromwhere + '&CatId=' + CatId + '&sharetype=' + sharetype + '&CHId=' + CHId;
        else if (fromwhere==1)
                Url = '../js/ajax/sharelinks.aspx?_SendNewMail=yes&UId=' + UserId + '&type=' + fromwhere + '&CatId=' + CatId + '&sharetype=' + sharetype + '&CHId=' + CHId +'&ImageId=' + ImageId + '&VideoId=' + VideoId + '&MotId=' + MotId;
        else if (fromwhere==2)
            Url = '../js/ajax/sharelinks.aspx?_SendNewMail=yes&UId=' + UserId + '&type=' + fromwhere + '&CatId=' + CatId + '&sharetype=' + sharetype + '&CHId=' + CHId +'&ImageId=' + ImageId + '&VideoId=' + VideoId + '&MotId=' + MotId;
        else if (fromwhere==3)
            Url = '../js/ajax/sharelinks.aspx?_SendNewMail=yes&UId=' + UserId + '&type=' + fromwhere + '&CatId=' + CatId + '&sharetype=' + sharetype + '&CHId=' + CHId;
        else if(fromwhere==4)
            Url = '../js/ajax/sharelinks.aspx?_SendNewMail=yes&UId=' + UserId + '&type=' + fromwhere + '&CatId=' + CatId + '&sharetype=' + sharetype + '&CHId=' + CHId +'&ImageId=' + ImageId + '&VideoId=' + VideoId;
        else if(fromwhere==5)
            Url = '../js/ajax/sharelinks.aspx?_SendNewMail=yes&UId=' + UserId + '&type=' + fromwhere + '&CatId=' + CatId + '&sharetype=' + sharetype + '&CHId=' + CHId +'&ImageId=' + ImageId + '&VideoId=' + VideoId;
    CreateXmlHttp();	
        if(XmlHttp)	{
        XmlHttp.open("POST", Url,  true);
        XmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
        XmlHttp.onreadystatechange = ServerMailSendResponse;	
        var param = 'emails=' + encodeURIComponent(emails.replace("'","")) + '&links=' + encodeURIComponent(window.location) + '&sub=' + encodeURIComponent(subject.replace("'","")) + '&msg=' + encodeURIComponent(Message.replace("'","")) + '&from=' + encodeURIComponent(From.replace("'",""));
        XmlHttp.send(param);
    } 
}
//function ServerMailSendResponse()
//{
//    if(XmlHttp.readyState == 4 && XmlHttp.status == 200)
//    {
//       if (XmlHttp.responseText == "Your message has been sent .")
//          HideVoteDiv();
//       else
//          HideDiv();
//    }    
//}
function ServerMailSendResponse()
{
    if(XmlHttp.readyState == 4 && XmlHttp.status == 200)
    {
        if (XmlHttp.responseText=='Your message has been sent.')
             {
             HideDiv();
             }
        else
            {
            HideDiv();
            }
            if (XmlHttp.responseText=='Your message has been sent.')
            {
            HideVoteDiv();
            }
            alert('Your message has been sent.');
            HideVoteDiv();
    }    
}
function GMailindex()
{
      var  Message = document.getElementById('ctl00_ContentPlaceHolder1_txtMessage').value;
     var  sub = document.getElementById('txtSubject').value;
    location.href = 'InviteFriends.aspx?type=gmailid&msg=' + encodeURIComponent(Message.replace("'","")) + '&sub=' + encodeURIComponent(sub.replace("'",""));;
}
function YahooMailindex()
{
     var  Message = document.getElementById('ctl00_ContentPlaceHolder1_txtMessage').value;
    var  sub = document.getElementById('txtSubject').value;
    location.href = 'InviteFriends.aspx?type=yahoomaiid&msg=' + encodeURIComponent(Message.replace("'","")) + '&sub=' + encodeURIComponent(sub.replace("'",""));;
}
function GMailprofile()
{
var objURL = new Object();
    var UserId = 0;
    var ImageId = 0;
    var VideoId =0;
    var CatId=0;
    var CHId=0;
    var MotId =0;
    var sharetype='';
    window.location.search.replace(new RegExp( "([^?=&]+)(=([^&]*))?", "g" ),function( $0, $1, $2, $3 ){objURL[ $1 ] = $3;});
    for (var strKey in objURL){
        if(strKey == "UId")
        {
            UserId = objURL[ strKey ];
        }  
        if(strKey == "ImageId")
        {
            ImageId = objURL[ strKey ];
        } 
         if(strKey == "VideoId")
        {
            VideoId = objURL[ strKey ];
        } 
        if(strKey == "CatId")
        {
            CatId = objURL[ strKey ];
        }
        if(strKey == "ImageId")
        {
            sharetype='image';
        }
        if(strKey == "VideoId")
        {
            sharetype='video';
        }  
         if(strKey == "CHId")
        {
            CHId=objURL[ strKey ];
        } 
        if(strKey == "MotId")
        {
            MotId=objURL[ strKey ];
        }   
    }
        var Url;
        var  Message = document.getElementById('txtVoteMessage').value;
        var  sub = document.getElementById('txtVoteSubject').value;
    location.href = '../InviteFriends.aspx?type=GMailprofile&type=' + sharetype + '&uid=' + UserId + '&CatId=' + CatId + '&CHId=' + CHId +'&ImageId=' + ImageId + '&VideoId=' + VideoId + '&msg=' + encodeURIComponent(Message.replace("'","")) + '&sub=' + encodeURIComponent(sub.replace("'",""));
}
function GMailShareprofile()
{
var objURL = new Object();
    var UserId = 0;
    var ImageId = 0;
    var VideoId =0;
    var CatId=0;
    var CHId=0;
    var MotId =0;
    var sharetype='';
    window.location.search.replace(new RegExp( "([^?=&]+)(=([^&]*))?", "g" ),function( $0, $1, $2, $3 ){objURL[ $1 ] = $3;});
    for (var strKey in objURL){
        if(strKey == "UId")
        {
            UserId = objURL[ strKey ];
        }  
        if(strKey == "ImageId")
        {
            ImageId = objURL[ strKey ];
        } 
         if(strKey == "VideoId")
        {
            VideoId = objURL[ strKey ];
        } 
        if(strKey == "CatId")
        {
            CatId = objURL[ strKey ];
        }
        if(strKey == "ImageId")
        {
            sharetype='image';
        }
        if(strKey == "VideoId")
        {
            sharetype='video';
        }  
         if(strKey == "CHId")
        {
            CHId=objURL[ strKey ];
        } 
        if(strKey == "MotId")
        {
            MotId=objURL[ strKey ];
        }   
    }
     var Url;
     if(CatId == null)
     {
      var  Message = document.getElementById('txtMessage').value;
     }
     else if(CatId ==0)
     {
     var  Message = document.getElementById('txtMessage').value;
     }
     else if(CatId >= 1)
     {
     var  Message = document.getElementById('txtMessage').value;
     }
     else
     {
     var  Message = document.getElementById('ctl00_ContentPlaceHolder1_txtMessage').value;
     }
      var  sub = document.getElementById('txtSubject').value;
    location.href = '../InviteFriends.aspx?type=GMailprofileshare&type=' + sharetype + '&uid=' + UserId + '&CatId=' + CatId + '&CHId=' + CHId +'&ImageId=' + ImageId + '&VideoId=' + VideoId + '&msg=' + encodeURIComponent(Message.replace("'","")) + '&sub=' + encodeURIComponent(sub.replace("'",""));
}
function GMail()
{
var objURL = new Object();
    var UserId = 0;
    var ImageId = 0;
    var VideoId =0;
    var CatId=0;
    var CHId=0;
    var MotId =0;
    var sharetype='';
    window.location.search.replace(new RegExp( "([^?=&]+)(=([^&]*))?", "g" ),function( $0, $1, $2, $3 ){objURL[ $1 ] = $3;});
    for (var strKey in objURL){
        if(strKey == "UId")
        {
            UserId = objURL[ strKey ];
        }  
        if(strKey == "ImageId")
        {
            ImageId = objURL[ strKey ];
        } 
         if(strKey == "VideoId")
        {
            VideoId = objURL[ strKey ];
        } 
        if(strKey == "CatId")
        {
            CatId = objURL[ strKey ];
        }
        if(strKey == "ImageId")
        {
            sharetype='image';
        }
        if(strKey == "VideoId")
        {
            sharetype='video';
        }  
         if(strKey == "CHId")
        {
            CHId=objURL[ strKey ];
        } 
        if(strKey == "MotId")
        {
            MotId=objURL[ strKey ];
        }   
    }
        var Url;
    location.href = '../InviteFriends.aspx?type=Chalgmail&type=' + sharetype + '&CatId=' + CatId + '&CHId=' + CHId +'&ImageId=' + ImageId + '&VideoId=' + VideoId;
}
function YahooMailshareprofile()
{
var objURL = new Object();
    var UserId = 0;
    var ImageId = 0;
    var VideoId =0;
    var CatId=0;
    var CHId=0;
    var MotId =0;
    var sharetype='';
    window.location.search.replace(new RegExp( "([^?=&]+)(=([^&]*))?", "g" ),function( $0, $1, $2, $3 ){objURL[ $1 ] = $3;});
    for (var strKey in objURL){
        if(strKey == "UId")
        {
            UserId = objURL[ strKey ];
        }  
        if(strKey == "ImageId")
        {
            ImageId = objURL[ strKey ];
        } 
         if(strKey == "VideoId")
        {
            VideoId = objURL[ strKey ];
        } 
        if(strKey == "CatId")
        {
            CatId = objURL[ strKey ];
        }
        if(strKey == "ImageId")
        {
            sharetype='image';
        }
        if(strKey == "VideoId")
        {
            sharetype='video';
        }  
         if(strKey == "CHId")
        {
            CHId=objURL[ strKey ];
        } 
        if(strKey == "MotId")
        {
            MotId=objURL[ strKey ];
        }   
    }
        var Url;
      //var  Message = document.getElementById('txtMessage').value;
      if(CatId == null)
     {
      var  Message = document.getElementById('txtMessage').value;
     }
     else if(CatId ==0)
     {
     var  Message = document.getElementById('txtMessage').value;
     }
     else
     {
     var  Message = document.getElementById('ctl00_ContentPlaceHolder1_txtMessage').value;
     }
      var  sub = document.getElementById('txtSubject').value;
    location.href = '../InviteFriends.aspx?type=YahooMailshareprofile&type=' + sharetype + '&CatId=' + CatId + '&uid=' + UserId + '&CHId=' + CHId +'&ImageId=' + ImageId + '&VideoId=' + VideoId + '&msg=' + encodeURIComponent(Message.replace("'","")) + '&sub=' + encodeURIComponent(sub.replace("'",""));
}
function YahooMailprofile()
{
var objURL = new Object();
    var UserId = 0;
    var ImageId = 0;
    var VideoId =0;
    var CatId=0;
    var CHId=0;
    var MotId =0;
    var sharetype='';
    window.location.search.replace(new RegExp( "([^?=&]+)(=([^&]*))?", "g" ),function( $0, $1, $2, $3 ){objURL[ $1 ] = $3;});
    for (var strKey in objURL){
        if(strKey == "UId")
        {
            UserId = objURL[ strKey ];
        }  
        if(strKey == "ImageId")
        {
            ImageId = objURL[ strKey ];
        } 
         if(strKey == "VideoId")
        {
            VideoId = objURL[ strKey ];
        } 
        if(strKey == "CatId")
        {
            CatId = objURL[ strKey ];
        }
        if(strKey == "ImageId")
        {
            sharetype='image';
        }
        if(strKey == "VideoId")
        {
            sharetype='video';
        }  
         if(strKey == "CHId")
        {
            CHId=objURL[ strKey ];
        } 
        if(strKey == "MotId")
        {
            MotId=objURL[ strKey ];
        }   
    }
        var Url;
           var  Message = document.getElementById('txtVoteMessage').value;
        var  sub = document.getElementById('txtVoteSubject').value;
    location.href = '../InviteFriends.aspx?type=YahooMailprofile&type=' + sharetype + '&CatId=' + CatId + '&uid=' + UserId + '&CHId=' + CHId +'&ImageId=' + ImageId + '&VideoId=' + VideoId + '&msg=' + encodeURIComponent(Message.replace("'","")) + '&sub=' + encodeURIComponent(sub.replace("'",""));
}
function YahooMail()
{
var objURL = new Object();
    var UserId = 0;
    var ImageId = 0;
    var VideoId =0;
    var CatId=0;
    var CHId=0;
    var MotId =0;
    var sharetype='';
    window.location.search.replace(new RegExp( "([^?=&]+)(=([^&]*))?", "g" ),function( $0, $1, $2, $3 ){objURL[ $1 ] = $3;});
    for (var strKey in objURL){
        if(strKey == "UId")
        {
            UserId = objURL[ strKey ];
        }  
        if(strKey == "ImageId")
        {
            ImageId = objURL[ strKey ];
        } 
         if(strKey == "VideoId")
        {
            VideoId = objURL[ strKey ];
        } 
        if(strKey == "CatId")
        {
            CatId = objURL[ strKey ];
        }
        if(strKey == "ImageId")
        {
            sharetype='image';
        }
        if(strKey == "VideoId")
        {
            sharetype='video';
        }  
         if(strKey == "CHId")
        {
            CHId=objURL[ strKey ];
        } 
        if(strKey == "MotId")
        {
            MotId=objURL[ strKey ];
        }   
    }
        var Url;
    location.href = '../InviteFriends.aspx?type=YahooMail&type=' + sharetype + '&CatId=' + CatId + '&CHId=' + CHId +'&ImageId=' + ImageId + '&VideoId=' + VideoId;
}
function SendMailForShareLinks(fromwhere)
{
    fromwhere = (fromwhere == null) ? 0 : fromwhere; 
    var emails = document.getElementById('txtemails').value;
    var subject = document.getElementById('txtSubject').value;
    var Message = document.getElementById('txtMessage').value;
    var From='';
    if(emails == '')
    {
        //alert('Enter Email Address!');
            document.getElementById('d1').style.height=document.body.clientHeight + 'px';
            document.getElementById('d1').style.width=document.body.clientWidth + 'px';
            document.getElementById('d1').style.visibility='visible';
            document.getElementById('divAlert').style.visibility = 'visible';
            document.getElementById('divAlert').style.display = 'block';
            document.getElementById('divAlert').style.top=250;
            document.getElementById('divAlert').style.left = 180;
            document.getElementById('ctl00_ContentPlaceHolder1_lblAlert').innerHTML='Please enter a valid email address';
            document.getElementById('d1').style.visibility="visible";
            document.getElementById('txtemails').value='';
        //document.getElementById('txtemails').focus();
        return false;   
    }
    if (echeckshare(emails)==false)
    {
        document.getElementById('txtemails').focus();
        return false;  
    }
    if(subject == '')
    {
        alert('Enter Subject!');
        var subject = document.getElementById('txtSubject').focus();
        return false;   
    }
    if(Message == '')
    {
        alert('Enter Message!');
        document.getElementById('txtMessage').focus();
        return false;   
    }
    if((document.getElementById('txtFrom') != null) && (typeof document.getElementById('txtFrom') != "undefined"))
    {
       From = document.getElementById('txtFrom').value;
       if (From == '')
         {
            alert('Enter your name!');
            document.getElementById('txtFrom').focus();
            return false;   
         } 
    }
        MailSending(emails, subject, Message, From, fromwhere);
}
//function DispVoteDiv()
//{
//    var Url;
//    Url = '../js/ajax/sharelinks.aspx?ChkSession=yes';
//     if(is_ie)
//       {
//            CreateXmlHttp();	
//                if(XmlHttp)	{
//                XmlHttp.onreadystatechange = VoteSessionResponse;	
//                XmlHttp.open("POST", Url,  true);	
//                XmlHttp.send(null);	}
//       }
//       else
//       {
//            CreateXmlHttp();	
//                if(XmlHttp)	{
//                XmlHttp.onreadystatechange = VoteSessionResponse;	
//                XmlHttp.open("GET", Url,  true);	
//                XmlHttp.send(null);	}
//       } 
//}

//function VoteSessionResponse()
//{
//    if(XmlHttp.readyState == 4 && XmlHttp.status == 200)
//     {
//        if(XmlHttp.responseText == 'Oops you are not Logged In!')
//        {
//            if(confirm(XmlHttp.responseText + '\t Do you want to login'))
//                location.href = '../login.aspx';
//        }
//        if(XmlHttp.responseText == 'Exists')
//        {
//        document.getElementById('votelayer').style.visibility = 'visible';
//        document.getElementById('votelayer').style.display = 'block';
//        document.getElementById('votelayer').style.top=350;
//        document.getElementById('votelayer').style.left = 200;
//        document.getElementById('txtVoteemails').value='';
//        document.getElementById('txtVoteemails').focus();
//        CreateFriendList('tdVoteFriendList' , 'txtVoteemails');
//        }
//     }   
//}
//var GetFlashIDgtflashidGetFlashID;
function DispVoteDiv()
{
if(doSub())
{
    var Url;
    Url = '../js/ajax/sharelinks.aspx?ChkSession=yes';
     if(is_ie)
       {
            CreateXmlHttp();	
                if(XmlHttp)	{
                XmlHttp.onreadystatechange = VoteSessionResponse;	
                XmlHttp.open("POST", Url,  true);	
                XmlHttp.send(null);	}
       }
       else
       {
            CreateXmlHttp();	
                if(XmlHttp)	{
                XmlHttp.onreadystatechange = VoteSessionResponse;	
                XmlHttp.open("GET", Url,  true);	
                XmlHttp.send(null);	}
       } 
       }
  else
{
          window.location.href='../login.aspx';
}
}
function VoteSessionResponse()
{
    if(XmlHttp.readyState == 4 && XmlHttp.status == 200)
     {
        if(XmlHttp.responseText == 'Oops you are not Logged In!')
        {
            if(confirm(XmlHttp.responseText + '\t Do you want to login'))
                location.href = '../login.aspx';
        }
        if(XmlHttp.responseText == 'Exists')
        {
        //gtflashid.style.visibility='hidden';
        document.getElementById('d1').style.height=document.body.clientHeight + 'px';
        document.getElementById('d1').style.width=document.body.clientWidth + 'px';
        document.getElementById('d1').style.visibility="visible"; 
        document.getElementById('votelayer').style.visibility = 'visible';
        document.getElementById('votelayer').style.display = 'block';
        document.getElementById('votelayer').style.top=350;
        document.getElementById('votelayer').style.left = 200;
        //document.getElementById('d1').style.visibility='visible'; 
        document.getElementById('txtVoteemails').value='';
        //document.getElementById('txtVoteMessage').value='Hey,\n\nYou are a really good friend - you are always looking out for me, and I really appreciate that.I totally need your support on something RIGHT NOW, and I know I can count on you!\n\nI posted to BlocBuzz to show off my talent, and have submitted my photographs to compete with other members.Every week BlocBuzz keeps track of who has the most highly ranked work, and the winners are named Famous People of the Week and are highlighted on the site.Weekly winners go on to be eligible for a monthly win, which would put me on their homepage!! This is just what I need to help me get my big break!.\n\nSo, what I need you to do is to check out my photos here:\n and VOTE FOR ME!!.Maybe even pass the word on to the rest of our friends to do the same.  It is not difficult and it just takes a minute, but its really important to me!I really appreciate it!.\n\nThanks sooooo much!\n\nP.S. If you havent joined the network yet yourself, you really should.That way we can become famous together! JOIN NOW!';
        document.getElementById('txtVoteemails').focus();
        CreateFriendList('tdVoteFriendList' , 'txtVoteemails');
        }
     }   
}
function Submitinv()
    {
        
            document.getElementById('divAlert').style.visibility = 'hidden';
            document.getElementById('d1').style.visibility='hidden'; 
    }
function HideVoteDiv()
{
    document.getElementById('votelayer').style.visibility = 'hidden';
    document.getElementById('votelayer').style.display = 'none';
    document.getElementById('d1').style.visibility='hidden'; 
    //document.getElementById('TestFlash').style.visibility='visible';
}
function SendMailForVoting(fromwhere)
{
    fromwhere = (fromwhere == null) ? 0 : fromwhere; 
    var emails = document.getElementById('txtVoteemails').value;
    var subject = document.getElementById('txtVoteSubject').value;
    var Message = document.getElementById('txtVoteMessage').value;
    var From = '';
    if(emails == '')
    {
        //alert('Enter Email Address!');
            document.getElementById('d1').style.height=document.body.clientHeight + 'px';
            document.getElementById('d1').style.width=document.body.clientWidth + 'px';
            document.getElementById('d1').style.visibility='visible';
            document.getElementById('divAlert').style.visibility = 'visible';
            document.getElementById('divAlert').style.display = 'block';
            document.getElementById('divAlert').style.top=250;
            document.getElementById('divAlert').style.left = 180;
            document.getElementById('ctl00_ContentPlaceHolder1_lblAlert').innerHTML='Please enter a valid email address';
            document.getElementById('d1').style.visibility="visible";
            document.getElementById('txtemails').value='';
        //document.getElementById('txtVoteemails').focus();
        return false;   
    }
      if (echeckshare(emails)==false)
      {
        document.getElementById('txtVoteemails').focus();
        return false;  
      }
      
    if(subject == '')
    {
        alert('Enter Subject!');
        document.getElementById('txtVoteSubject').focus();
        return false;   
    }
     if(Message == '')
    {
        alert('Enter Message!');
        document.getElementById('txtVoteMessage').focus();
        return false;   
    }
     if((document.getElementById('txtFrom') != null) && (typeof document.getElementById('txtFrom') != "undefined"))
    {
       From = document.getElementById('txtFrom').value;
       if (From == '')
         {
            alert('Enter your name!');
            document.getElementById('txtFrom').focus();
            return false;   
         }
    }
        MailSending(emails, subject, Message, From, fromwhere);
}
function TellYourFriends(fromwhere)
{
    fromwhere = (fromwhere == null) ? 0 : fromwhere; 
    var emails = document.getElementById('txtemails').value;
    var subject = document.getElementById('txtSubject').value;
    var Message = document.getElementById('ctl00_ContentPlaceHolder1_txtMessage').value;
    var From = '';
       
    if(emails == '')
    {
        //alert('Please enter a valid email address.');
        document.getElementById('d1').style.height=document.body.clientHeight + 'px';
        document.getElementById('d1').style.width=document.body.clientWidth + 'px';
        document.getElementById('d1').style.visibility='visible';
        document.getElementById('divAlert').style.visibility = 'visible';
        document.getElementById('divAlert').style.display = 'block';
        document.getElementById('divAlert').style.top=250;
        document.getElementById('divAlert').style.left = 180;
        document.getElementById('ctl00_ContentPlaceHolder1_lblAlert').innerHTML='Please enter a valid email address';
        document.getElementById('d1').style.visibility="visible";
        document.getElementById('txtemails').value='';
        return false;   
    }
    if (echeck(emails)==false)
    {
        document.getElementById('txtemails').focus();
        return false;  
    }
   if(subject == '')
    {
        alert('Enter Subject!');
        var subject = document.getElementById('txtSubject').focus();
        return false;   
    }
    if((document.getElementById('txtFrom') != null) && (typeof document.getElementById('txtFrom') != "undefined"))
    {
       From = document.getElementById('txtFrom').value;
       if (From == '')
         {
            alert('Enter your name!');
            document.getElementById('txtFrom').focus();
            return false;   
         } 
    }
     MailToFriends(emails, subject, Message, From, fromwhere);
}
function fnMsgText(UId,poolname,poolid,Name,Name1,bcheck)
{
var pname='';
var plink='';
var videolink=window.location;
if (poolname!='')
{
pname='This video is part of the ' + poolname + ' pool on blocbuzz.com. ';
var pArray = poolid.split(",");
plink='\nCheck it Out here.\n';
for (var x = 0; x < pArray.length; x++)
{
plink=plink + 'http://blocbuzz.com/Index.aspx?CatId='+ pArray[x] + '\n';
}
}
if(bcheck == "False")
{
document.getElementById('txtVoteMessage').value='Hey,\n\nYou are a really good friend - and I totally need your support on something RIGHT NOW, and I know I can count on you!\n\nI have joined BlocBuzz.com, a place where you can create a Buzz about you.\n Every day BlocBuzz keeps track of who was able to pull the most crowd towards him/her.The folks with highest overall likeability become the Featured People thereby helping them get Famous.\n So, what I need you to do is to check out my videos here ' +videolink +' and VOTE FOR ME!!.\nMaybe even pass the word on to the rest of our friends to do the same.Its not difficult and it just takes a minute, but its really important to me! I really appreciate it!\n\nThanks sooooo much!\n\n'+ Name +'\n\nP.S. If you havent joined the network yet yourself, you really should. That way we can create a Buzz together! JOIN NOW!';
}
else
{
document.getElementById('txtVoteSubject').value='I request you to give points to ' + Name1 + ' Video.';
document.getElementById('txtVoteMessage').value='I request you to give points to ' + Name1 + ' Video.Please check it out. He deserves some appreciation and Points.Pls vote for him.\n\n' + videolink + '\n\n Thanks,\n'+ Name;
}
}
function fnShareMsgText(Name,Name1,bcheck)
{
var videolink=window.location;
if(bcheck == "False")
{
document.getElementById('txtVoteMessage').value='Hi,\n\n' + Name + ' would like to share one of the videos that they have featured on BlocBuzz with you.\n\nYou can see it here:\n' + videolink +'\n\nWe hope you enjoy it!';
}
else
{
document.getElementById('txtVoteSubject').value='I request you to give points to ' + Name1 + ' Video.';
document.getElementById('txtVoteMessage').value='I request you to give points to ' + Name1 + ' Video.Please check it out. He deserves some appreciation and Points.Pls vote for him.\n\n' + videolink + '\n\n'+ '\n\n Thanks,\n'+ Name;
}
//document.getElementById('txtMessage').value='Hello Friend,\n' + Name + ' would like to share the video with you.\n' + videolink;
//document.getElementById('txtMessage').value='Hi,\n' + Name + ' would like to share one of the videos that they have featured on BlocBuzz with you.\n You can see it here.\n' + videolink +'\n\n We hope you enjoy it!';
}

function MailToFriends(emails, subject, Message, From, fromwhere)
{
    var objURL = new Object();
    var UserId = 0;
    var ImageId = 0;
    var CatId=0;
    window.location.search.replace(new RegExp( "([^?=&]+)(=([^&]*))?", "g" ),function( $0, $1, $2, $3 ){objURL[ $1 ] = $3;});
    for (var strKey in objURL){
        if(strKey == "UId")
        {
            UserId = objURL[ strKey ];
        }  
        if(strKey == "ImageId")
        {
            ImageId = objURL[ strKey ];
        }  
        if(strKey == "CatId")
        {
            CatId = objURL[ strKey ];
        }  
    }
        if (fromwhere==0)
            var Url = 'js/ajax/sharelinks.aspx?_SendNewMail=yes&UId=' + UserId + '&type=' + fromwhere + '&CatId=' + CatId ;
        else if (fromwhere==1)
            var Url = '../js/ajax/sharelinks.aspx?_SendNewMail=yes&UId=' + UserId + '&type=' + fromwhere + '&CatId=' + CatId ;
    CreateXmlHttp();	
        if(XmlHttp)	{
        XmlHttp.open("POST", Url,  true);
        XmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
        XmlHttp.onreadystatechange = ServerMailSendResponse;	
        var param = 'emails=' + encodeURIComponent(emails.replace("'","")) + '&links=' + encodeURIComponent(window.location) + '&sub=' + encodeURIComponent(subject.replace("'","")) + '&msg=' + encodeURIComponent(Message.replace("'","")) + '&from=' + encodeURIComponent(From.replace("'",""));
        XmlHttp.send(param);
    } 
}
function isEmail(string) {
   if (!string) return false;
   var iChars = "*|,\":<>[]{}`\';()&$#%";
   for (var i = 0; i < string.length; i++) {
      if (iChars.indexOf(string.charAt(i)) != -1)
         return false;
   }
   return true;
} 
function echeckforgetpass(str) {
var part_num = 0;
var email_array = new Array();
var str1;
//alert(str);
str1= str.replace(/^\s+|\s+$/g, '');
email_array = str1.split(",");
var emailReg = "\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*";
var regex = new RegExp(emailReg);
//var emailReg = "^[\\w-_\.+]*[\\w-_\.]\@([\\w]+\\.)+[\\w]+[\\w]$"; 
//var emailReg = "^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$"
var at="@";
var dot=".";
var lat=0;
var lstr=0;
var ldot=0;
var count = 0;
for (part_num = 0; part_num < email_array.length; part_num++)
{
lat=email_array[part_num].indexOf(at);
lstr=email_array[part_num].length;
ldot=email_array[part_num].indexOf(dot);
if (email_array[part_num].indexOf(at)==-1){
document.getElementById('ctl00_ContentPlaceHolder1_LblForgetPass').innerHTML="";
document.getElementById('d1').style.height=document.body.clientHeight + 'px';
document.getElementById('d1').style.width=document.body.clientWidth + 'px';
document.getElementById('d1').style.visibility='visible'; 
document.getElementById('divAlert').style.visibility = 'visible';
document.getElementById('divAlert').style.display = 'block';
document.getElementById('divAlert').style.top=250;
document.getElementById('divAlert').style.left = 180;
document.getElementById('ctl00_ContentPlaceHolder1_lblAlert').innerHTML='Please enter a valid email address';
document.getElementById('d1').style.visibility="visible";
document.getElementById('ctl00_ContentPlaceHolder1_txtEmails').value='';
document.getElementById('ctl00_ContentPlaceHolder1_txtEmails').focus();
return false;
}
if (email_array[part_num].indexOf(at)==-1 || email_array[part_num].indexOf(at)==0 || email_array[part_num].indexOf(at)==lstr){

document.getElementById('ctl00_ContentPlaceHolder1_LblForgetPass').innerHTML="";

document.getElementById('d1').style.height=document.body.clientHeight + 'px';

document.getElementById('d1').style.width=document.body.clientWidth + 'px';

document.getElementById('d1').style.visibility='visible'; 

document.getElementById('divAlert').style.visibility = 'visible';

document.getElementById('divAlert').style.display = 'block';

document.getElementById('divAlert').style.top=250;

document.getElementById('divAlert').style.left = 180;

document.getElementById('ctl00_ContentPlaceHolder1_lblAlert').innerHTML='Please enter a valid email address';

document.getElementById('d1').style.visibility="visible";

document.getElementById('ctl00_ContentPlaceHolder1_txtEmails').value='';

document.getElementById('ctl00_ContentPlaceHolder1_txtEmails').focus();

return false;

}

if (email_array[part_num].indexOf(dot)==-1 || email_array[part_num].indexOf(dot)==0 || email_array[part_num].indexOf(dot)==lstr){

document.getElementById('ctl00_ContentPlaceHolder1_LblForgetPass').innerHTML="";

document.getElementById('d1').style.height=document.body.clientHeight + 'px';

document.getElementById('d1').style.width=document.body.clientWidth + 'px';

document.getElementById('d1').style.visibility='visible'; 

document.getElementById('divAlert').style.visibility = 'visible';

document.getElementById('divAlert').style.display = 'block';

document.getElementById('divAlert').style.top=250;

document.getElementById('divAlert').style.left = 180;

document.getElementById('ctl00_ContentPlaceHolder1_lblAlert').innerHTML='Please enter a valid email address';

document.getElementById('d1').style.visibility="visible";

document.getElementById('ctl00_ContentPlaceHolder1_txtEmails').value='';

document.getElementById('ctl00_ContentPlaceHolder1_txtEmails').focus();

return false;

}

if (email_array[part_num].indexOf(at,(lat+1))!=-1){

document.getElementById('ctl00_ContentPlaceHolder1_LblForgetPass').innerHTML="";

document.getElementById('d1').style.height=document.body.clientHeight + 'px';

document.getElementById('d1').style.width=document.body.clientWidth + 'px';

document.getElementById('d1').style.visibility='visible'; 

document.getElementById('divAlert').style.visibility = 'visible';

document.getElementById('divAlert').style.display = 'block';

document.getElementById('divAlert').style.top=250;

document.getElementById('divAlert').style.left = 180;

document.getElementById('ctl00_ContentPlaceHolder1_lblAlert').innerHTML='Please enter a valid email address';

document.getElementById('d1').style.visibility="visible";

document.getElementById('ctl00_ContentPlaceHolder1_txtEmails').value='';

document.getElementById('ctl00_ContentPlaceHolder1_txtEmails').focus();

return false;

}

if (email_array[part_num].substring(lat-1,lat)==dot || email_array[part_num].substring(lat+1,lat+2)==dot){

document.getElementById('ctl00_ContentPlaceHolder1_LblForgetPass').innerHTML="";

document.getElementById('d1').style.height=document.body.clientHeight + 'px';

document.getElementById('d1').style.width=document.body.clientWidth + 'px';

document.getElementById('d1').style.visibility='visible'; 

document.getElementById('divAlert').style.visibility = 'visible';

document.getElementById('divAlert').style.display = 'block';

document.getElementById('divAlert').style.top=250;

document.getElementById('divAlert').style.left = 180;

document.getElementById('ctl00_ContentPlaceHolder1_lblAlert').innerHTML='Please enter a valid email address';

document.getElementById('d1').style.visibility="visible";

document.getElementById('ctl00_ContentPlaceHolder1_txtEmails').value='';

document.getElementById('ctl00_ContentPlaceHolder1_txtEmails').focus();

return false;

}

if (email_array[part_num].indexOf(dot,(lat+2))==-1){

document.getElementById('ctl00_ContentPlaceHolder1_LblForgetPass').innerHTML="";

document.getElementById('d1').style.height=document.body.clientHeight + 'px';

document.getElementById('d1').style.width=document.body.clientWidth + 'px';

document.getElementById('d1').style.visibility='visible'; 

document.getElementById('divAlert').style.visibility = 'visible';

document.getElementById('divAlert').style.display = 'block';

document.getElementById('divAlert').style.top=250;

document.getElementById('divAlert').style.left = 180;

document.getElementById('ctl00_ContentPlaceHolder1_lblAlert').innerHTML='Please enter a valid email address';

document.getElementById('d1').style.visibility="visible";

document.getElementById('ctl00_ContentPlaceHolder1_txtEmails').value='';

document.getElementById('ctl00_ContentPlaceHolder1_txtEmails').focus();

return false;

}


if (email_array[part_num].indexOf(" ")!=-1){

document.getElementById('ctl00_ContentPlaceHolder1_LblForgetPass').innerHTML="";

document.getElementById('d1').style.height=document.body.clientHeight + 'px';

document.getElementById('d1').style.width=document.body.clientWidth + 'px';

document.getElementById('d1').style.visibility='visible'; 

document.getElementById('divAlert').style.visibility = 'visible';

document.getElementById('divAlert').style.display = 'block';

document.getElementById('divAlert').style.top=250;

document.getElementById('divAlert').style.left = 180;

document.getElementById('ctl00_ContentPlaceHolder1_lblAlert').innerHTML='Please enter a valid email address';

document.getElementById('d1').style.visibility="visible";

document.getElementById('ctl00_ContentPlaceHolder1_txtEmails').value='';

document.getElementById('ctl00_ContentPlaceHolder1_txtEmails').focus();

return false;

}


if(!isEmail(email_array[part_num]))

{

document.getElementById('ctl00_ContentPlaceHolder1_LblForgetPass').innerHTML="";

document.getElementById('d1').style.height=document.body.clientHeight + 'px';

document.getElementById('d1').style.width=document.body.clientWidth + 'px';

document.getElementById('d1').style.visibility='visible'; 

document.getElementById('divAlert').style.visibility = 'visible';

document.getElementById('divAlert').style.display = 'block';

document.getElementById('divAlert').style.top=250;

document.getElementById('divAlert').style.left = 180;

document.getElementById('ctl00_ContentPlaceHolder1_lblAlert').innerHTML='Please enter a valid email address';

document.getElementById('d1').style.visibility="visible";

document.getElementById('ctl00_ContentPlaceHolder1_txtEmails').value='';

document.getElementById('ctl00_ContentPlaceHolder1_txtEmails').focus();

return false;

}

var isNumeric = email_array[part_num].charAt(email_array[part_num].length-1)

if(parseInt(isNumeric) >= 0 && parseInt(isNumeric) <= 9)

{

document.getElementById('ctl00_ContentPlaceHolder1_LblForgetPass').innerHTML="";

document.getElementById('d1').style.height=document.body.clientHeight + 'px';

document.getElementById('d1').style.width=document.body.clientWidth + 'px';

document.getElementById('d1').style.visibility='visible'; 

document.getElementById('divAlert').style.visibility = 'visible';

document.getElementById('divAlert').style.display = 'block';

document.getElementById('divAlert').style.top=250;

document.getElementById('divAlert').style.left = 180;

document.getElementById('ctl00_ContentPlaceHolder1_lblAlert').innerHTML='Please enter a valid email address';

document.getElementById('d1').style.visibility="visible";

document.getElementById('ctl00_ContentPlaceHolder1_txtEmails').value='';

document.getElementById('ctl00_ContentPlaceHolder1_txtEmails').focus();

return false;

}

// var emailcontent;

// emailcontent = email_array[part_num].split("@");

// var emaildetail = emailcontent[1].split["."];

// for (i=0;i < emaildetail.length;i++)

// {

// if(emaildetail[i] == ".")

// {

// var j;
// if(j>1)
// {
// j=1;
// }
// else
// {
// document.getElementById('ctl00_ContentPlaceHolder1_lblMsg').innerHTML="";
// document.getElementById('d1').style.height=document.body.clientHeight + 'px';
// document.getElementById('d1').style.width=document.body.clientWidth + 'px';
// document.getElementById('d1').style.visibility='visible'; 
// document.getElementById('divAlert').style.visibility = 'visible';
// document.getElementById('divAlert').style.display = 'block';
// document.getElementById('divAlert').style.top=250;
// document.getElementById('divAlert').style.left = 180;
// document.getElementById('ctl00_ContentPlaceHolder1_lblAlert').innerHTML='Please enter a valid email address';
// document.getElementById('d1').style.visibility="visible";
// document.getElementById('ctl00_ContentPlaceHolder1_txtEmails').value='';
// document.getElementById('ctl00_ContentPlaceHolder1_txtEmails').focus();
// return false;
// }
// }
// }
}
return true;
}
function echeckshare(str)
{
var part_num = 0;
var email_array = new Array();
var str1;
//alert(str);
str1= str.replace(/^\s+|\s+$/g, '');
email_array = str1.split(",");
var emailReg = "\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*";
var regex = new RegExp(emailReg);
//var emailReg = "^[\\w-_\.+]*[\\w-_\.]\@([\\w]+\\.)+[\\w]+[\\w]$";
//var emailReg = "^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$"
var at="@";
var dot=".";
var lat=0;
var lstr=0;
var ldot=0;
var count = 0;
var ldotstr="";
var lSplitlength=0;
var ilength=0;
for (part_num = 0; part_num < email_array.length; part_num++)
{
lat=email_array[part_num].indexOf(at);
lstr=email_array[part_num].length;
ldot=email_array[part_num].indexOf(dot);
ldotstr=email_array[part_num].substring(lat);
lSplitlength=ldotstr.split(dot).length;
ilength = ldotstr.lastIndexOf(dot)- ldotstr.indexOf(dot);
if (email_array[part_num].indexOf(at)==-1){
//document.getElementById('ctl00_ContentPlaceHolder1_lblMsg').innerHTML="";
document.getElementById('d1').style.height=document.body.clientHeight + 'px';
document.getElementById('d1').style.width=document.body.clientWidth + 'px';
document.getElementById('d1').style.visibility='visible';
document.getElementById('divAlert').style.visibility = 'visible';
document.getElementById('divAlert').style.display = 'block';
document.getElementById('divAlert').style.top=250;
document.getElementById('divAlert').style.left = 180;
document.getElementById('ctl00_ContentPlaceHolder1_lblAlert').innerHTML='Please enter a valid email address';
document.getElementById('d1').style.visibility="visible";
document.getElementById('txtemails').value='';
//document.getElementById('Button1').focus();
return false;
}
if(lSplitlength > 3 || ilength == 1)
{
//document.getElementById('ctl00_ContentPlaceHolder1_lblMsg').innerHTML="";
document.getElementById('d1').style.height=document.body.clientHeight + 'px';
document.getElementById('d1').style.width=document.body.clientWidth + 'px';
document.getElementById('d1').style.visibility='visible';
document.getElementById('divAlert').style.visibility = 'visible';
document.getElementById('divAlert').style.display = 'block';
document.getElementById('divAlert').style.top=250;
document.getElementById('divAlert').style.left = 180;
document.getElementById('ctl00_ContentPlaceHolder1_lblAlert').innerHTML='Please enter a valid email address';
document.getElementById('d1').style.visibility="visible";
document.getElementById('txtemails').value='';
//document.getElementById('Button1').focus();
return false;
}
if (email_array[part_num].indexOf(at)==-1 || email_array[part_num].indexOf(at)==0 || email_array[part_num].indexOf(at)==lstr){
//document.getElementById('ctl00_ContentPlaceHolder1_lblMsg').innerHTML="";
document.getElementById('d1').style.height=document.body.clientHeight + 'px';
document.getElementById('d1').style.width=document.body.clientWidth + 'px';
document.getElementById('d1').style.visibility='visible';
document.getElementById('divAlert').style.visibility = 'visible';
document.getElementById('divAlert').style.display = 'block';
document.getElementById('divAlert').style.top=250;
document.getElementById('divAlert').style.left = 180;
document.getElementById('ctl00_ContentPlaceHolder1_lblAlert').innerHTML='Please enter a valid email address';
document.getElementById('d1').style.visibility="visible";
document.getElementById('txtemails').value='';
//document.getElementById('Button1').focus();
return false;
}
if (email_array[part_num].indexOf(dot)==-1 || email_array[part_num].indexOf(dot)==0 || email_array[part_num].indexOf(dot)==lstr){
//document.getElementById('ctl00_ContentPlaceHolder1_lblMsg').innerHTML="";
document.getElementById('d1').style.height=document.body.clientHeight + 'px';
document.getElementById('d1').style.width=document.body.clientWidth + 'px';
document.getElementById('d1').style.visibility='visible';
document.getElementById('divAlert').style.visibility = 'visible';
document.getElementById('divAlert').style.display = 'block';
document.getElementById('divAlert').style.top=250;
document.getElementById('divAlert').style.left = 180;
document.getElementById('ctl00_ContentPlaceHolder1_lblAlert').innerHTML='Please enter a valid email address';
document.getElementById('d1').style.visibility="visible";
document.getElementById('txtemails').value='';
//document.getElementById('Button1').focus();
return false;
}
if (email_array[part_num].indexOf(at,(lat+1))!=-1){
//document.getElementById('ctl00_ContentPlaceHolder1_lblMsg').innerHTML="";
document.getElementById('d1').style.height=document.body.clientHeight + 'px';
document.getElementById('d1').style.width=document.body.clientWidth + 'px';
document.getElementById('d1').style.visibility='visible';
document.getElementById('divAlert').style.visibility = 'visible';
document.getElementById('divAlert').style.display = 'block';
document.getElementById('divAlert').style.top=250;
document.getElementById('divAlert').style.left = 180;
document.getElementById('ctl00_ContentPlaceHolder1_lblAlert').innerHTML='Please enter a valid email address';
document.getElementById('d1').style.visibility="visible";
document.getElementById('txtemails').value='';
//document.getElementById('Button1').focus();
return false;
}
if (email_array[part_num].substring(lat-1,lat)==dot || email_array[part_num].substring(lat+1,lat+2)==dot){
//document.getElementById('ctl00_ContentPlaceHolder1_lblMsg').innerHTML="";
document.getElementById('d1').style.height=document.body.clientHeight + 'px';
document.getElementById('d1').style.width=document.body.clientWidth + 'px';
document.getElementById('d1').style.visibility='visible';
document.getElementById('divAlert').style.visibility = 'visible';
document.getElementById('divAlert').style.display = 'block';
document.getElementById('divAlert').style.top=250;
document.getElementById('divAlert').style.left = 180;
document.getElementById('ctl00_ContentPlaceHolder1_lblAlert').innerHTML='Please enter a valid email address';
document.getElementById('d1').style.visibility="visible";
document.getElementById('txtemails').value='';
//document.getElementById('Button1').focus();
return false;
}
if (email_array[part_num].indexOf(dot,(lat+2))==-1){
//document.getElementById('ctl00_ContentPlaceHolder1_lblMsg').innerHTML="";
document.getElementById('d1').style.height=document.body.clientHeight + 'px';
document.getElementById('d1').style.width=document.body.clientWidth + 'px';
document.getElementById('d1').style.visibility='visible';
document.getElementById('divAlert').style.visibility = 'visible';
document.getElementById('divAlert').style.display = 'block';
document.getElementById('divAlert').style.top=250;
document.getElementById('divAlert').style.left = 180;
document.getElementById('ctl00_ContentPlaceHolder1_lblAlert').innerHTML='Please enter a valid email address';
document.getElementById('d1').style.visibility="visible";
document.getElementById('txtemails').value='';
//document.getElementById('Button1').focus();
return false;
}
if (email_array[part_num].indexOf(" ")!=-1){
//document.getElementById('ctl00_ContentPlaceHolder1_lblMsg').innerHTML="";
document.getElementById('d1').style.height=document.body.clientHeight + 'px';
document.getElementById('d1').style.width=document.body.clientWidth + 'px';
document.getElementById('d1').style.visibility='visible';
document.getElementById('divAlert').style.visibility = 'visible';
document.getElementById('divAlert').style.display = 'block';
document.getElementById('divAlert').style.top=250;
document.getElementById('divAlert').style.left = 180;
document.getElementById('ctl00_ContentPlaceHolder1_lblAlert').innerHTML='Please enter a valid email address';
document.getElementById('d1').style.visibility="visible";
document.getElementById('txtemails').value='';
//document.getElementById('Button1').focus();
return false;
}
if(!isEmail(email_array[part_num]))
{
//document.getElementById('ctl00_ContentPlaceHolder1_lblMsg').innerHTML="";
document.getElementById('d1').style.height=document.body.clientHeight + 'px';
document.getElementById('d1').style.width=document.body.clientWidth + 'px';
document.getElementById('d1').style.visibility='visible';
document.getElementById('divAlert').style.visibility = 'visible';
document.getElementById('divAlert').style.display = 'block';
document.getElementById('divAlert').style.top=250;
document.getElementById('divAlert').style.left = 180;
document.getElementById('ctl00_ContentPlaceHolder1_lblAlert').innerHTML='Please enter a valid email address';
document.getElementById('d1').style.visibility="visible";
document.getElementById('txtemails').value='';
//document.getElementById('Button1').focus();
return false;
}
var isNumeric = email_array[part_num].charAt(email_array[part_num].length-1)
if(parseInt(isNumeric) >= 0 && parseInt(isNumeric) <= 9)
{
//document.getElementById('ctl00_ContentPlaceHolder1_lblMsg').innerHTML="";
document.getElementById('d1').style.height=document.body.clientHeight + 'px';
document.getElementById('d1').style.width=document.body.clientWidth + 'px';
document.getElementById('d1').style.visibility='visible';
document.getElementById('divAlert').style.visibility = 'visible';
document.getElementById('divAlert').style.display = 'block';
document.getElementById('divAlert').style.top=250;
document.getElementById('divAlert').style.left = 180;
document.getElementById('ctl00_ContentPlaceHolder1_lblAlert').innerHTML='Please enter a valid email address';
document.getElementById('d1').style.visibility="visible";
document.getElementById('txtemails').value='';
//document.getElementById('Button1').focus();
return false;
}
}
return true;
}

function echeckinvite(str)

{

var part_num = 0;

var email_array = new Array();

var str1;

str1= str.replace(/^\s+|\s+$/g, '');

email_array = str1.split(",");

var emailReg = "\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*";

var regex = new RegExp(emailReg);

var at="@";

var dot=".";

var lat=0;

var lstr=0;

var ldot=0;

var count = 0;

var ldotstr="";

var lSplitlength=0;

var ilength=0;

for (part_num = 0; part_num < email_array.length; part_num++)

{

lat=email_array[part_num].indexOf(at);

lstr=email_array[part_num].length;

ldot=email_array[part_num].indexOf(dot);

ldotstr=email_array[part_num].substring(lat);

lSplitlength=ldotstr.split(dot).length;

ilength = ldotstr.lastIndexOf(dot)- ldotstr.indexOf(dot);

if (email_array[part_num].indexOf(at)==-1){

document.getElementById('ctl00_ContentPlaceHolder1_lblMsg').innerHTML="";

document.getElementById('ctl00_ContentPlaceHolder1_invitefriends').value='Please enter a valid email address';
return false;
}
if(lSplitlength > 3 || ilength == 1)

{
document.getElementById('ctl00_ContentPlaceHolder1_lblMsg').innerHTML="";

document.getElementById('ctl00_ContentPlaceHolder1_invitefriends').value='Please enter a valid email address';

return false;
}
if (email_array[part_num].indexOf(at)==-1 || email_array[part_num].indexOf(at)==0 || email_array[part_num].indexOf(at)==lstr){

document.getElementById('ctl00_ContentPlaceHolder1_lblMsg').innerHTML="";
document.getElementById('ctl00_ContentPlaceHolder1_invitefriends').value='Please enter a valid email address';
return false;
}
if (email_array[part_num].indexOf(dot)==-1 || email_array[part_num].indexOf(dot)==0 || email_array[part_num].indexOf(dot)==lstr){

document.getElementById('ctl00_ContentPlaceHolder1_lblMsg').innerHTML="";
document.getElementById('ctl00_ContentPlaceHolder1_invitefriends').value='Please enter a valid email address';
return false;
}
if (email_array[part_num].indexOf(at,(lat+1))!=-1){

document.getElementById('ctl00_ContentPlaceHolder1_lblMsg').innerHTML="";
document.getElementById('ctl00_ContentPlaceHolder1_invitefriends').value='Please enter a valid email address';
return false;

}

if (email_array[part_num].substring(lat-1,lat)==dot || email_array[part_num].substring(lat+1,lat+2)==dot){

document.getElementById('ctl00_ContentPlaceHolder1_lblMsg').innerHTML="";
document.getElementById('ctl00_ContentPlaceHolder1_invitefriends').value='Please enter a valid email address';
return false;
}
if (email_array[part_num].indexOf(dot,(lat+2))==-1){
document.getElementById('ctl00_ContentPlaceHolder1_lblMsg').innerHTML="";
document.getElementById('ctl00_ContentPlaceHolder1_invitefriends').value='Please enter a valid email address';
return false;
}
if (email_array[part_num].indexOf(" ")!=-1){
document.getElementById('ctl00_ContentPlaceHolder1_lblMsg').innerHTML="";
document.getElementById('ctl00_ContentPlaceHolder1_invitefriends').value='Please enter a valid email address';
return false;
}
if(!isEmail(email_array[part_num]))
{
document.getElementById('ctl00_ContentPlaceHolder1_lblMsg').innerHTML="";
document.getElementById('ctl00_ContentPlaceHolder1_invitefriends').value='Please enter a valid email address';
return false;
}
var isNumeric = email_array[part_num].charAt(email_array[part_num].length-1)
if(parseInt(isNumeric) >= 0 && parseInt(isNumeric) <= 9)
{
document.getElementById('ctl00_ContentPlaceHolder1_lblMsg').innerHTML="";
document.getElementById('ctl00_ContentPlaceHolder1_invitefriends').value='Please enter a valid email address';
return false;

}

}

return true;

}







function echeck(str)
{
var part_num = 0;
var email_array = new Array();
var str1;
//alert(str);
str1= str.replace(/^\s+|\s+$/g, '');
email_array = str1.split(",");
var emailReg = "\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*";
var regex = new RegExp(emailReg);
//var emailReg = "^[\\w-_\.+]*[\\w-_\.]\@([\\w]+\\.)+[\\w]+[\\w]$";
//var emailReg = "^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$"
var at="@";
var dot=".";
var lat=0;
var lstr=0;
var ldot=0;
var count = 0;
var ldotstr="";
var lSplitlength=0;
var ilength=0;
for (part_num = 0; part_num < email_array.length; part_num++)
{
lat=email_array[part_num].indexOf(at);
lstr=email_array[part_num].length;
ldot=email_array[part_num].indexOf(dot);
ldotstr=email_array[part_num].substring(lat);
lSplitlength=ldotstr.split(dot).length;
ilength = ldotstr.lastIndexOf(dot)- ldotstr.indexOf(dot);
if (email_array[part_num].indexOf(at)==-1){
//document.getElementById('ctl00_ContentPlaceHolder1_lblMsg').innerHTML="";
document.getElementById('d1').style.height=document.body.clientHeight + 'px';
document.getElementById('d1').style.width=document.body.clientWidth + 'px';
document.getElementById('d1').style.visibility='visible';
document.getElementById('divAlert').style.visibility = 'visible';
document.getElementById('divAlert').style.display = 'block';
document.getElementById('divAlert').style.top=250;
document.getElementById('divAlert').style.left = 180;
document.getElementById('ctl00_ContentPlaceHolder1_lblAlert').innerHTML='Please enter a valid email address';
document.getElementById('d1').style.visibility="visible";
document.getElementById('txtemails').value='';
//document.getElementById('txtEmails').focus();
return false;
}
if(lSplitlength > 3 || ilength == 1)
{
//document.getElementById('ctl00_ContentPlaceHolder1_lblMsg').innerHTML="";
document.getElementById('d1').style.height=document.body.clientHeight + 'px';
document.getElementById('d1').style.width=document.body.clientWidth + 'px';
document.getElementById('d1').style.visibility='visible';
document.getElementById('divAlert').style.visibility = 'visible';
document.getElementById('divAlert').style.display = 'block';
document.getElementById('divAlert').style.top=250;
document.getElementById('divAlert').style.left = 180;
document.getElementById('ctl00_ContentPlaceHolder1_lblAlert').innerHTML='Please enter a valid email address';
document.getElementById('d1').style.visibility="visible";
document.getElementById('txtemails').value='';
//document.getElementById('txtEmails').focus();
return false;
}
if (email_array[part_num].indexOf(at)==-1 || email_array[part_num].indexOf(at)==0 || email_array[part_num].indexOf(at)==lstr){
//document.getElementById('ctl00_ContentPlaceHolder1_lblMsg').innerHTML="";
document.getElementById('d1').style.height=document.body.clientHeight + 'px';
document.getElementById('d1').style.width=document.body.clientWidth + 'px';
document.getElementById('d1').style.visibility='visible';
document.getElementById('divAlert').style.visibility = 'visible';
document.getElementById('divAlert').style.display = 'block';
document.getElementById('divAlert').style.top=250;
document.getElementById('divAlert').style.left = 180;
document.getElementById('ctl00_ContentPlaceHolder1_lblAlert').innerHTML='Please enter a valid email address';
document.getElementById('d1').style.visibility="visible";
document.getElementById('txtemails').value='';
//document.getElementById('txtEmails').focus();
return false;
}
if (email_array[part_num].indexOf(dot)==-1 || email_array[part_num].indexOf(dot)==0 || email_array[part_num].indexOf(dot)==lstr){
//document.getElementById('ctl00_ContentPlaceHolder1_lblMsg').innerHTML="";
document.getElementById('d1').style.height=document.body.clientHeight + 'px';
document.getElementById('d1').style.width=document.body.clientWidth + 'px';
document.getElementById('d1').style.visibility='visible';
document.getElementById('divAlert').style.visibility = 'visible';
document.getElementById('divAlert').style.display = 'block';
document.getElementById('divAlert').style.top=250;
document.getElementById('divAlert').style.left = 180;
document.getElementById('ctl00_ContentPlaceHolder1_lblAlert').innerHTML='Please enter a valid email address';
document.getElementById('d1').style.visibility="visible";
document.getElementById('txtemails').value='';
//document.getElementById('txtEmails').focus();
return false;
}
if (email_array[part_num].indexOf(at,(lat+1))!=-1){
//document.getElementById('ctl00_ContentPlaceHolder1_lblMsg').innerHTML="";
document.getElementById('d1').style.height=document.body.clientHeight + 'px';
document.getElementById('d1').style.width=document.body.clientWidth + 'px';
document.getElementById('d1').style.visibility='visible';
document.getElementById('divAlert').style.visibility = 'visible';
document.getElementById('divAlert').style.display = 'block';
document.getElementById('divAlert').style.top=250;
document.getElementById('divAlert').style.left = 180;
document.getElementById('ctl00_ContentPlaceHolder1_lblAlert').innerHTML='Please enter a valid email address';
document.getElementById('d1').style.visibility="visible";
document.getElementById('txtemails').value='';
//document.getElementById('txtEmails').focus();
return false;
}

if (email_array[part_num].substring(lat-1,lat)==dot || email_array[part_num].substring(lat+1,lat+2)==dot){
//document.getElementById('ctl00_ContentPlaceHolder1_lblMsg').innerHTML="";
document.getElementById('d1').style.height=document.body.clientHeight + 'px';
document.getElementById('d1').style.width=document.body.clientWidth + 'px';
document.getElementById('d1').style.visibility='visible';
document.getElementById('divAlert').style.visibility = 'visible';
document.getElementById('divAlert').style.display = 'block';
document.getElementById('divAlert').style.top=250;
document.getElementById('divAlert').style.left = 180;
document.getElementById('ctl00_ContentPlaceHolder1_lblAlert').innerHTML='Please enter a valid email address';
document.getElementById('d1').style.visibility="visible";
document.getElementById('txtemails').value='';
//document.getElementById('txtEmails').focus();
return false;
}
if (email_array[part_num].indexOf(dot,(lat+2))==-1){
//document.getElementById('ctl00_ContentPlaceHolder1_lblMsg').innerHTML="";
document.getElementById('d1').style.height=document.body.clientHeight + 'px';
document.getElementById('d1').style.width=document.body.clientWidth + 'px';
document.getElementById('d1').style.visibility='visible';
document.getElementById('divAlert').style.visibility = 'visible';
document.getElementById('divAlert').style.display = 'block';
document.getElementById('divAlert').style.top=250;
document.getElementById('divAlert').style.left = 180;
document.getElementById('ctl00_ContentPlaceHolder1_lblAlert').innerHTML='Please enter a valid email address';
document.getElementById('d1').style.visibility="visible";
document.getElementById('txtemails').value='';
//document.getElementById('txtEmails').focus();
return false;
}

if (email_array[part_num].indexOf(" ")!=-1){
//document.getElementById('ctl00_ContentPlaceHolder1_lblMsg').innerHTML="";
document.getElementById('d1').style.height=document.body.clientHeight + 'px';
document.getElementById('d1').style.width=document.body.clientWidth + 'px';
document.getElementById('d1').style.visibility='visible';
document.getElementById('divAlert').style.visibility = 'visible';
document.getElementById('divAlert').style.display = 'block';
document.getElementById('divAlert').style.top=250;
document.getElementById('divAlert').style.left = 180;
document.getElementById('ctl00_ContentPlaceHolder1_lblAlert').innerHTML='Please enter a valid email address';
document.getElementById('d1').style.visibility="visible";
document.getElementById('txtemails').value='';
//document.getElementById('txtEmails').focus();
return false;
}
if(!isEmail(email_array[part_num]))
{
//document.getElementById('ctl00_ContentPlaceHolder1_lblMsg').innerHTML="";
document.getElementById('d1').style.height=document.body.clientHeight + 'px';
document.getElementById('d1').style.width=document.body.clientWidth + 'px';
document.getElementById('d1').style.visibility='visible';
document.getElementById('divAlert').style.visibility = 'visible';
document.getElementById('divAlert').style.display = 'block';
document.getElementById('divAlert').style.top=250;
document.getElementById('divAlert').style.left = 180;
document.getElementById('ctl00_ContentPlaceHolder1_lblAlert').innerHTML='Please enter a valid email address';
document.getElementById('d1').style.visibility="visible";
document.getElementById('txtemails').value='';
//document.getElementById('txtEmails').focus();
return false;
}
var isNumeric = email_array[part_num].charAt(email_array[part_num].length-1)
if(parseInt(isNumeric) >= 0 && parseInt(isNumeric) <= 9)
{
//document.getElementById('ctl00_ContentPlaceHolder1_lblMsg').innerHTML="";
document.getElementById('d1').style.height=document.body.clientHeight + 'px';
document.getElementById('d1').style.width=document.body.clientWidth + 'px';
document.getElementById('d1').style.visibility='visible';
document.getElementById('divAlert').style.visibility = 'visible';
document.getElementById('divAlert').style.display = 'block';
document.getElementById('divAlert').style.top=250;
document.getElementById('divAlert').style.left = 180;
document.getElementById('ctl00_ContentPlaceHolder1_lblAlert').innerHTML='Please enter a valid email address';
document.getElementById('d1').style.visibility="visible";
document.getElementById('txtemails').value='';
//document.getElementById('txtEmails').focus();
return false;
}
}
return true;
}