/*
if (document.all) {
}
else if (document.getElementById) { 
    document.captureEvents(Event.MOUSEDOWN)
}
else if (document.layers) {
    document.captureEvents(Event.MOUSEDOWN)
}

document.onmousedown = mousedown_handler

function mousedown_handler(mouse_event) {

    // This is the message that will appear
    var no_right_click = "Sorry, right-clicking is not allowed!"
    
    if (document.all) {

        //Probably Internet Explorer 4 and later
        if (event.button == 2 || event.button == 3) {
            alert(no_right_click)
            return false
        }
    }
    else if (document.getElementById) { 

        // Probably Netscape 6 and later
        if (mouse_event.which == 3) {
            alert(no_right_click)
            return false
        }
    }
    else if (document.layers) {

        // Probably Netscape 4
        if (mouse_event.which == 3) {
            alert(no_right_click)
            return false
        }
    }
}
*/
//Preventing Right Clicks end




/* Functions for email subscription popup add START */
var ie5=document.all&&document.getElementById
var ns6=document.getElementById&&!document.all

function loadwindow(url,width,height)
{
	if (!ie5&&!ns6)
		window.open(url,"","width=width,height=height,scrollbars=no")
	else
	{
		document.getElementById("dwindow").style.position='absolute'
		document.getElementById("dwindow").style.display=''
		document.getElementById("dwindow").style.width=width+"px"
		document.getElementById("dwindow").style.height=height+"px"
		document.getElementById("dwindow").style.left="275px"
		document.getElementById("dwindow").style.top=120+"px"
		document.getElementById("cframe").src=url
		document.getElementById("cframe").height=height+"px"
		document.getElementById("cframe").width=width+"px"
		document.getElementById("cframe").frameborder=0+"px"
		document.getElementById("cframe").hspace=0
		document.getElementById("cframe").vspace=0
		document.getElementById("cframe").marginwidth=0
		document.getElementById("cframe").marginheight=0
		document.getElementById("cframe").marginheight=0
	}
}

function closeit()
{
	document.getElementById("dwindow").style.display="none"
}
/* Functions for email subscription popup add END */


  function getCookie(name) { // use: getCookie("name");
    var bikky = document.cookie;
    var index = bikky.indexOf(name + "=");
    if (index == -1) return null;
    index = bikky.indexOf("=", index) + 1; // first character
    var endstr = bikky.indexOf(";", index);
    if (endstr == -1) endstr = bikky.length; // last character
    return unescape(bikky.substring(index, endstr));
  }
  
  
function getCookie1(name)
{
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}


function changeBG(objRow, mouseState)
{
	var sColor = '#f4f4f4';
	if (mouseState == 'on')
	{
      		sColor = '#f4f4f4';
   	}
	else if(mouseState == 'off')
	{
		sColor = '#eeeeee';
	}
	objRow.bgColor = sColor;
}

function openNL(loc, title)
{
	window.open(loc,title,'menubar=yes,scrollbars=yes,location=no,resizable=1,toolbar=0,status=0,width=740,height=600,scrollbars=yes,left=250,top=10');
}

function openWin(loc)
{
	window.open(loc,'icct','menubar=yes,scrollbars=yes,location=no,resizable=1,toolbar=0,status=0,width=700,height=900,scrollbars=yes,left=250,top=10');
}


function openImage(img_loc, title1, intheight, intwidth)
{
	var newWindow = window.open("","newWin","menubar=yes,scrollbars=yes,location=no,resizable=1,toolbar=0,status=0,width=700,height=400,left=300,top=30");
	with (newWindow.document)
	{
		open();
		write("<html><head>");
		write("<link href='/includes/icctnew.css' type='text/css' rel='stylesheet' />" );
		write("</head>");
		write("<title>India Cultural Center and Temple</title>" );

		write("<body onLoad='reSizeWin()'>");
		write("<div align=center>");


		write("<table cellpadding=0 cellspacing=0 border=0  width='100%' >");
		write("<tr><td class=txt12rb height=20 valign=middle align=left width='80%'>&nbsp;"+ title1+ "</td>");
		write("<td width='20%' align=right><a class=alink href='javascript:window.close();'>Close</a>&nbsp;</td></tr>");
		write("</table>");
		
		write("<table cellpadding=0 cellspacing=1 border=0 bgcolor='#ffffff'  width='100%' >");
		//write("<tr><td align=center><img src='"+img_loc+"' border=0 height="+intheight+" width="+intwidth+"></td></tr>");
		write("<tr><td align=center><img src='"+img_loc+"' border=0 ></td></tr>");
		write("</table>");

		write("<scr"+"ipt>");

		if(parseInt(intheight)>700)
			intheight = '750';
		
		if(parseInt(intwidth)>650)
			intwidth = '650';

		var inth = (parseInt(intheight) + 140);
		var intw = (parseInt(intwidth) + 100);

		write("function reSizeWin()");
		write("{");
		write("	window.resizeTo(" + intw + ", " + inth + ");");
		write("}");
		
		write("</scr"+"ipt>");
		
		
		write("</div>");
		write("</body>");

		
		close();
	}
}


function sendafriend()
{
	document.sendafriend.page.value=location.href;
	document.sendafriend.submit();
}


function submitForm1()
{
  var formlist = "";
  var missingreq = false;

  var frm = document.forms["subscribe"];
  frm.elements["email2"].value = frm.elements["email"].value;

  // check first to see if we are unsubscribing
  // if so no need to validate...
  if (frm.elements["wanttodo"] && frm.wanttodo[0].checked)          
      return true;

  if (frm.elements["email"].value == "")
      missingreq = true;

  // validate email is of correct format
  var emailregex = /^[\w\_\-\.]+@[\w\_\-\.]+\.\w+$/;
  var emailresult = frm.email.value.match(emailregex);

  if (emailresult == null)
  {
      alert("The email address \'" + frm.email.value + "\' is not in a correct format.\n Please try again"
      );
      return false;
  }

  // naming of form elements is as follows:
  // CUSTOM##  - not required custom demographic
  // RCUSTOM## - required custom demographic
  for (i = 0; i < frm.elements.length; i++)
  {
      if (frm.elements[i].type == "text" && frm.elements[i].name.substring(0, 7) == "RCUSTOM")
      {
	  if (frm.elements[i].value == "")
	      missingreq = true;
      }

      if (frm.elements[i].type == "radio" && frm.elements[i].name.substring(0, 7) == "RCUSTOM")
      {
	  var onechecked = false;
	  for (r = 0; r < frm.elements.length; r++)
	  {
	      if (frm.elements[r].name == frm.elements[i].name && frm.elements[r].checked)
		  onechecked = true;
	  }

	  if (!onechecked)
	      missingreq = true;
      }

      if (frm.elements[i].type == "select-one" && frm.elements[i].name.substring(0, 7) == "RCUSTOM")
      {
	  if (frm.elements[i].selectedIndex == 0)
	      missingreq = true;
      }
  }

  if (missingreq)
  {
      msg = "The form was not submitted because required fields were not filled.\nPlease fill in all required fields and re-submit.\n";

      alert(msg);
      return false;
  }

  return true;
}