function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external")
     anchor.target = "_blank";
 }
 
}
function checkAddress(f1)
{
	if(f1.checked)
	{
		document.frmedit.ship_address.value = document.frmedit.address.value;
		document.frmedit.ship_city.value = document.frmedit.city.value;
		document.frmedit.ship_state.value = document.frmedit.state.value;
		document.frmedit.ship_zip.value = document.frmedit.zip.value;
		document.frmedit.ship_phone.value = document.frmedit.phone.value;
		
	} 
	else {
		document.frmedit.ship_address.value = "";
		document.frmedit.ship_city.value = "";
		document.frmedit.ship_state.value = "";
		document.frmedit.ship_zip.value = "";
		document.frmedit.ship_phone.value = "";
		
	}
}

function contest_wise() {
	var theStr = new String(document.leftnav_frm_contest.contestlist.value);
	var index = theStr.indexOf("###");
	if (index < 1 && theStr != "")
	{	
		document.leftnav_frm_contest.action="/promo/contestredirect.php?id="+theStr;
		document.leftnav_frm_contest.submit();
	}
}
function contestcitystatewise(id,type) {
	if(type==1)
	{
		var theStr = new String(document.frmedit.City1.value);
	}
	else
	{
			var theStr = new String(document.frmedit.State1.value);
	}
	var index = theStr.indexOf("###");
	if (index < 1 && theStr != "")
	{	
	document.frmedit.action="index.php?type="+type+"&citystate="+theStr;
	document.frmedit.submit();
	}
}
function openWin( windowURL, windowName, windowFeatures )
{
	return window.open( windowURL, windowName, windowFeatures ) ; 
}

function launch_video(type,vid) {
	newWindow = openWin( 'http://www.topsinamerica.com/launch.php?type=' + type + '&vid=' + vid, 'SelectMediaPlayer', 'width=620,height=400,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=1,resizable=1' ); 
	newWindow.focus();
}

function launch_flv(id) {
	newWindow = openWin( '/flv/index.php?id=' + id, 'TopsinAmericaVideoStream', 'width=500,height=400,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=1' ); 
	newWindow.focus();
}

function state_wise() {
	var theStr = new String(document.leftnav_frm.statelist.value);
	var index = theStr.indexOf("###");
	if (index < 1 && theStr != "")
	{
	document.leftnav_frm.citylist.value="";
	document.leftnav_frm.action="/citywise.php/"+theStr;
	document.leftnav_frm.submit();
	}
}
function city_wise() {
	var theStr = new String(document.leftnav_frm.citylist.value);
	var index = theStr.indexOf("###");
	if (index < 1 && theStr != "")
	{
	document.leftnav_frm.statelist.value ="";
	document.leftnav_frm.action="/citywise.php/"+theStr;
	document.leftnav_frm.submit();
	}
}
function contestwise(id,type) {
	var theStr = new String(document.frmedit.City1.value);
	var index = theStr.indexOf("###");
	if (index < 1 && theStr != "")
	{	
	document.frmedit.action="index.php?type="+type+"&citystate="+theStr;
	document.frmedit.submit();
	}
}
function category_wise() {
	var theStr = new String(document.leftnav_frm_category.categorylist.value);
	var index = theStr.indexOf("###");
	if (index < 1 && theStr != "")
	{
	document.leftnav_frm_category.categorylist.value ="";
	document.leftnav_frm_category.action="/category.php?cat=/"+theStr;
	document.leftnav_frm_category.submit();
	}
}
<!-- Shri added -->
function playvideo(id)
{
		
var emid="emmit_video"+id;	
	 if(navigator.appName == "Microsoft Internet Explorer")
	{
		document.getElementById(emid).Play();	
		//document.embeds[emid].Play();
	}
	else
	{	
		//window.document[emid].Play();
		document.embeds[emid].Play();
		//document.getElementById(emid).Play();	
	}
	
}


window.onload = externalLinks;

var tmp_loop=1;
var i=1;
function moreFiles()
{
	 var table = document.getElementById("tblid");
	
	 var tBody = table.getElementsByTagName("tbody")[0];
	 var rows = tBody.getElementsByTagName("tr");
	 var lastRow = rows[rows.length-1];
	 var newRow = lastRow.cloneNode(true);
	tBody.appendChild(newRow);
}
			
function Files()
{
	document.getElementById("tblid").style.display="block";
	document.getElementById("first").style.display="none";
	document.getElementById("second").style.display="block";
}
function openwin(page)
{
	var ourl;
	ourl = page;
	window.open(ourl,'details','width=350,height=360,scrollbars=yes,resizable=yes');
}

function chk_report_type()
	{
		var obj=document.frmedit;
		var type=obj.report_type.value;
		if(type ==  8)
			{
			obj.target="_blank";
			obj.action='ceridian_report.php';
			obj.submit();
			}
		else
			{
			obj.action='display_report.php';
			obj.submit();
			}
		
	}
	
function checkAll()
		{
			if(document.exportfrm.checkone)
				{//check for rows in the view page
					document.exportfrm.checkone.checked=document.exportfrm.checkall.checked;
					for(i=0;i<document.exportfrm.checkone.length;i++)
					document.exportfrm.checkone[i].checked=document.exportfrm.checkall.checked;
				}
			else
				{
					alert("Nothing to select");
					document.exportfrm.checkall.checked=false;
				}
		}