﻿//for Poll

function getpoll(id)
{
    var mid=5;
    for (i=0;i<document.aspnetForm.vote.length;i++)
    {
      if (document.aspnetForm.vote[i].checked==true)
      mid=i;
    }
        //alert(document.getElementsByName("vote").value);
    if (mid==5)
    {
        alert("Please select an option");
    }
    else
    {
       
         window.open("pollresult.aspx?rid="+id+document.aspnetForm.vote[mid].value,'poll','height=290,width=400,scrollbars=no,statusbar=no,top=0,left=0');
           // alert("pollresult.aspx?rid="+id+document.form1.vote[mid].value);
    }
    //return true;
}

//for comment
function PostClick()
{
   if (document.getElementById("ctl00_ContentPlaceHolder1_txt_Name").value != "" && document.getElementById("ctl00_ContentPlaceHolder1_txt_Place").value != "" &&   document.getElementById("ctl00_ContentPlaceHolder1_txtEmail").value != "" &&  document.getElementById("ctl00_ContentPlaceHolder1_txt_Comment").value != "") 
   {
   alert("Thank You. Your comment will be published after it is cleared by our moderator. ");
   }
   else
   {
    return false;
   }
}

//for validatig E mail

function ValidateEMail(objName)
{
	var sobjValue;
	var iobjLength;
	var counterE=0;
	
	sobjValue=objName.value;
	iobjLength=sobjValue.length;
	iFposition=sobjValue.indexOf("@");
	iSposition=sobjValue.indexOf(".");
	iTmp=sobjValue.lastIndexOf(".");	
	iPosition=sobjValue.indexOf(",");
	iPos=sobjValue.indexOf(";");	
	if (iobjLength!=0)
	{
		if ((iFposition == -1)||(iSposition == -1))
		{
			counterE = 1;
		}
		else if(sobjValue.charAt(0) == "@" || sobjValue.charAt(0)==".")
		{
			counterE = 1;
		}
		
		else
		{
			return true;
		}				
	}	
	else
	{
	    return false;
	}	
	if (counterE == 1)
	{
	    alert("Email id is wrong");	 
	    objName.focus();
		return false;
	}	
	return true;	
}


function ValidateEMailMe(objName)
{
	var sobjValue;
	var iobjLength;
	var counterE=0;
	
	sobjValue=objName.value;
	iobjLength=sobjValue.length;
	iFposition=sobjValue.indexOf("@");
	iSposition=sobjValue.indexOf(".");
	iTmp=sobjValue.lastIndexOf(".");	
	iPosition=sobjValue.indexOf(",");
	iPos=sobjValue.indexOf(";");	
	if (iobjLength!=0)
	{
		if ((iFposition == -1)||(iSposition == -1))
		{
			counterE = 1;
		}
		else if(sobjValue.charAt(0) == "@" || sobjValue.charAt(0)==".")
		{
			counterE = 1;
		}
		else if(sobjValue.charAt(iobjLength) == "@" ||
			sobjValue.charAt(iobjLength)==".")
		{
			counterE = 1;				
		}	
		else if((sobjValue.indexOf("@",(iFposition+1)))!=-1)
		{	
			counterE = 1;
		}
		else if ((iobjLength-(iTmp+1)<2)||(iobjLength-(iTmp+1)>3))
		{
			counterE = 1;
		}
		else if ((iPosition!=-1) || (iPos!=-1))
		{
			counterE = 1;			
		}
		else
		{
			return true;
		}				
	}	
	else
	{
	    return false;
	}	
	if (counterE == 1)
	{
	    alert("Email id is wrong");	 
	    objName.focus();
		return false;
	}
	return false;		
}

//for links

// JScript File
function opinions(typ)
	{
	 if (typ=="yahoo")
	    {
	    mytarget="http://myweb2.search.yahoo.com/myresults/bookmarklet?t="+encodeURIComponent(document.title)+"&u="+encodeURIComponent(document.location.href)+" ";
	    window.open(mytarget);
	    }
	 if (typ=="fark")
	    {
	    mytarget="http://cgi.fark.com/cgi/fark/edit.pl?new_url="+encodeURIComponent(document.location.href)+"&new_comment="+encodeURIComponent(document.title)+"&new_link_other=&linktype=Misc";
	    window.open(mytarget);

	    }
	 if (typ=="digg")
	    {
	    mytarget="http://digg.com/submit?phase=2&url="+encodeURIComponent(document.location.href)+" ";
	    window.open(mytarget);

	    }
	 if (typ=="reditt")
	    {
	    mytarget="http://reddit.com/submit?url="+encodeURIComponent(document.location.href)+"&title="+encodeURIComponent(document.title)+" ";
	    window.open(mytarget);
	    
	    }
	 if (typ=="del")
	    {
	    mytarget="http://del.icio.us/post?v=2&url="+encodeURIComponent(document.location.href)+"&title="+encodeURIComponent(document.title)+" ";
	    window.open(mytarget);

	    }
	 if (typ=="newsvine")
	    {
	    mytarget="http://www.newsvine.com/_tools/seed&save?u="+encodeURIComponent(document.location.href)+"&h="+encodeURIComponent(document.title)+" ";
	    window.open(mytarget);

	    }
	 }
	 function EmailMe(titlefor)
	 {
	    mytarget = "/sendemail.aspx?urlfor="+encodeURIComponent(document.location.href)+"&whois=story&stitle="+titlefor;
	    window.open(mytarget, 'email', 'width=455,height=305,scrollBars=no,statusbar=no');
	 }
	 
	 function EmailMeGallery(titlefor, imgid)
	 {
	    mytarget = "/sendemail.aspx?urlfor="+encodeURIComponent("http://www.zeenews.com/photogallery/image"+imgid+".htm")+"&whois=image&stitle="+titlefor;
	    window.open(mytarget, 'email', 'width=455,height=305,scrollBars=no,statusbar=no');
	 }
	 
	 function EmailMeVideo(titlefor, videoid)
	 {
	    mytarget = "/sendemail.aspx?urlfor="+encodeURIComponent("http://www.zeenews.com/video/showvideo"+videoid+".html")+"&whois=video&stitle="+titlefor;
	    window.open(mytarget, 'email', 'width=455,height=305,scrollBars=no,statusbar=no');
	 }
	 function ValideTxt(objVal)
	 {
	    var val = objVal;
	    if(val!='')
	    {
            	  val = val.replace("'", "`");
            	  val = val.replace("\"","``");
	    }
	    return objVal;
	 }

//for user registration

function vidcehck()
{

        if (document.getElementById("ctl00_ContentPlaceHolder1_txt_Name").value=="")
        {
             alert("Please Enter Name.");
	   
	      return false;
    	   

            
        }
        
         if (document.getElementById("ctl00_ContentPlaceHolder1_txt_Mobile").value=="")
        {
             alert("Please Enter Mobile Number.");

             return false;
        }
         if (document.getElementById("ctl00_ContentPlaceHolder1_txt_Email").value=="")
        {
             alert("Please Enter Email.");

             return false;
        }
         if (document.getElementById("ctl00_ContentPlaceHolder1_txt_Password").value=="")
        {
             alert("Please Enter Password");

             return false;
        }
         if (document.getElementById("ctl00_ContentPlaceHolder1_txt_ConfirmPassword").value=="")
        {
             alert("Please Enter Confirm Password");

             return false;
        }
        
           if (document.getElementById("ctl00_ContentPlaceHolder1_drpSex").value=="Select")
        {
             alert("Please Select Sex");

             return false;
        }
           if (document.getElementById("ctl00_ContentPlaceHolder1_drpAge").value=="Select")
        {
             alert("Please Select Age");

             return false;
        }
           if (document.getElementById("ctl00_ContentPlaceHolder1_drpEducation").value=="Select")
        {
             alert("Please Select  Education");

             return false;
        }
           if (document.getElementById("ctl00_ContentPlaceHolder1_drpMartila").value=="Select")
        {
             alert("Please Select  Marital Status.");

             return false;
        }
}


function vidchkpass()
{
    if (document.getElementById("ctl00_ContentPlaceHolder1_txt_Password").value != document.getElementById("ctl00_ContentPlaceHolder1_txt_ConfirmPassword").value)
 {
        alert("Password and  confirm Password dosen't match ,Please Try again");
        document.getElementById("ctl00_ContentPlaceHolder1_txt_ConfirmPassword").value="";
       
         return false;
 }

}

//for states open
function openstate(val)
{
	if (val.value!='Select')
	{
			location.href=val.value
	}
}
	

