//EJalgaon.com JavaScript Library
//Last Update: 20th May 2011

function MM_jumpMenu(targ,selObj,restore)
{ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function validatemidc(f)
{
	if(f.search.value=="")
	{
		alert("Please specify Search Text...");
		f.search.focus();
		return false;
	}
	
	f.action="/MIDC search/midcsearch.asp";
	f.submit();
	return true;
}

function pollpost(f)
{
	var opival = "c";

	if (f.optype[0].checked) 
	{
		opival="y";
	}

	if (f.optype[1].checked) 
	{
		opival="n";
	}

	if (f.optype[2].checked) 
	{
		opival="c";
	}
	ques=f.ques.value;
	opt1=f.opt1.value;
	opt2=f.opt2.value;
	opt3=f.opt3.value;

       var fnam="/asp/polldisplay.asp?addflag=1&opival=" + opival + "&opt1=" + opt1 + "&opt2=" + opt2 + "&opt3=" + opt3+ "&ques=" + ques; 

	window.open(fnam,"poll","resizable=no,toolbar=0,location=0,menubar=0,status=0,height=400,width=300,,scrollbars=0");
}
function subme(t)
{
	var k=0;
	var unsubs="n";
	var emailpat =/^(\".*\"|[A-Za-z0-9]\w*)@(\[\d{1,3}(\.\d{1,3}){3}]|[A-Za-z0-9]\w*(\.[A-Za-z0-9]\w*)+)$/;
	var matcharray = window.document.subscribe.email.value.match(emailpat);

    if (matcharray == null)
      { k=1;
        alert("Invalid E-mail Id");
        return false;
      }

	if (window.document.subscribe.unsub.checked)
	{
	unsubs="y";
	}

	if (k==0)
	{
	var email=t.email.value
	var fnam="asp/subscribe.asp?email=" + email + "&unsub=" + unsubs
	window.open(fnam,"_newwindow","resizable=no,toolbar=0,height=300,width=270,,scrollbars=0")
	}

	return true;
}

function showpoll2()
{
	ques=window.document.opinion.ques.value;
	var fnam="/asp/polldisplay.asp?ques=" + ques ;
	
	window.open(fnam,"_newwindow","resizable=no,toolbar=0,location=0,menubar=0,status=0,height=500,width=300,,scrollbars=0");
}

function valstd(f)
{
	if(f.placename.value=="") 
	{
	alert("Please Type Place name to Search...Use Any for complete listing");
	f.placename.focus();
	return false;
	}
	f.action="asp/jalgaon telephones.asp";
	f.submit();
	return true;
}

function valtelesearch(f)
{
	if((f.namesearch.value=="") && (f.phonesearch.value==""))
	{
		alert("Please Type Name/ Telephone no. to search");
		f.namesearch.focus();
		return false;
	}
f.action="asp/tsearch4.asp";
f.submit();
return true;
}

function CheckForm () {

	if (document.frmSiteSearch.search.value==""){
		alert("Please enter at least one keyword to search");
		document.frmSiteSearch.search.focus();
		return false;
	}
	
	return true
}

var dt     = 0;
var possDt  = 0;
var tdChecked = false;
var tz     = 5;
var tzMin  = 30;
var id     = null;

function init() {

   adjustDate();
   displayTime();
      defaultSelected = 0;
      selectedIndex = 0;
}

function setPlace() 
{
tz = 5; tzMin = 30; possDt = 0;
tdChecked = false;
displayTime();
}

function adjustDate() {
   var base = new Date()
   var testDate = base
   testDate = testDate.toLocaleString()
   testDate = new Date(testDate)
   zoneError = (base.getTimezoneOffset() >= 720) ? (1000 * 60 * 60 * 24) : 0
   correctErrors = 2 * (testDate.getTime() - base.getTime()) - zoneError
}

function leadZero(x) {
   if (x < 10) {
       x = "0" + x;
   }
   return(x);
}

function getDt(x) {
   month = x.getMonth()+1;
   if (((month >= 4) && (month <= 10)) && (possDt == 1)) {
      dt = 1;
   }
   else if (((month <=4) || (month >= 10)) && (possDt == 2)) {
      dt = 1;
   }
   else if (((month <=3) || (month >= 11)) && (possDt == 3)) {
      dt = 1;
   }  
   else if (((month <=1) || (month >= 10)) && (possDt == 4)) {
      dt = 1;
   }  
   else {
      dt = 0;
   }
   tdChecked = true;
}

function formatDate(x) {
   daynames   = "SunMonTueWedThuFriSat";
   monthnames = "JanFebMarAprMayJunJulAugSepOctNovDec";
   month = x.getMonth();
   dom = x.getDate();
   dow = x.getDay();
   year = x.getYear();
   return(" "+daynames.substring(dow *3 ,dow * 3 +3)+", "+dom+" "+monthnames.substring(month * 3, month * 3 + 3)+" "+year);
}

function formatTime(x) {
   hour   = leadZero(x.getHours());
   minute = leadZero(x.getMinutes());
   second = leadZero(x.getSeconds());
   return(" "+hour+":"+minute+":"+second)
}

/*
function displayTime(){
   var dummy = new Date();
   var target = new Date();

   if (!tdChecked) {
       getDt(dummy);
   }
   target.setTime(dummy.getTime() + ((tz + dt) * 60 + tzMin) * 60 * 1000 - correctErrors);
   time = target.toGMTString();
   target.setTime(Date.parse(time.substring(0, time.length -3)));

   document.worldclock.timeshow.value = formatTime(target);
   id = setTimeout("displayTime()",999);
}
*/
function shayari()
{
	var fnam="today/shayaritoday.html"

	window.open(fnam,"shayari","resizable=no,toolbar=0,location=0,menubar=0,status=0,height=500,width=700,,scrollbars=1");

}
function jokewind()
{
	var fnam="today/joketoday.html"

	window.open(fnam,"joke","resizable=no,toolbar=0,location=0,menubar=0,status=0,height=500,width=500,,scrollbars=1");

}

function quotes()
{
	var fnam="today/quote of the day.htm"

	window.open(fnam,"Quote","resizable=no,toolbar=0,location=0,menubar=0,status=0,height=500,width=500,,scrollbars=1");

}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}


function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
	}

function photoview(pname)
{
	document.getElementById('photothumbview').style.display='none';
	document.getElementById('photoview').src=pname;
	document.getElementById('pdisplay').style.display='block';
}

function photoback(pname)
{
	document.getElementById('pdisplay').style.display='none';
	document.getElementById('photothumbview').style.display='block';
}

