﻿// JScript File

<!--- Hall of Fame Ajax --->
function replace(file,element) {
	var http = false;
	
	try{
		// Opera 8.0+, Firefox, Safari
		http = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			http = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				http = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				//alert("Your browser broke!");
				return false;
			}
		}
	}
  http.open("GET", file, true);
  http.onreadystatechange=function() {
    if(http.readyState == 4 && http.status == 200) {
      document.getElementById(element).innerHTML = http.responseText;
    }
  }
  http.send(null);
  return "";
}


function vid(filename)
{
var myvideo="<embed src=http://img.zeenews.com/mediaplayer.swf width=288 height=240  allowscriptaccess=always allowfullscreen=true flashvars=overstretch=true&showstop=true&width=288&height=240&file=" + filename + "&autostart=true/>";
document.getElementById("videos").innerHTML=myvideo;
}


function getpoll(id)
{
    var mid=5;
    for (i=0;i<document.form1.vote.length;i++)
    {
      if (document.form1.vote[i].checked==true)
      mid=i;
    }
    if (mid==5)
    {
        alert("Please select an option");
    }
    else
    {
       window.open("pollresult.aspx?rid="+id+document.form1.vote[mid].value,'poll','height=290,width=400,scrollbars=no,statusbar=no,top=0,left=0');
     }
}

//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;		
}

