var mapt
var mapt1
var newY

var lctn1= "http:\/\/www.satp.org\/"
var lctn = "http:\/\/www.satp.org\/satporgtp\/"


//var lctn1= "http:\/\/192.168.0.2\/"
//var lctn = "http:\/\/192.168.0.2\/satporgtp\/"


function mapop(name)
{
if (name=="battle" )
{
name=lctn+"maps/warmap.htm"
jin=window.open(name,'mask','fullscreen=yes, resizable=1')
}
else
{
name=lctn+"maps/map.asp?name="+name
jin=window.open(name,'mask','height=390 width=670');
}
}
var intervalID
var flag=0
var flag1=1
name1="bangladesh.jpg"

if(quickBar== "terror")
 {
	 
document.write("<div id='warmap' style='position:absolute; left:150px; top:83px;  z-index:2'><a href=# onclick=window.open('"+lctn+"maps/warmap.htm','','fullscreen=yes')><img src="+lctn+"templates/images/war.jpg border=0></a></div>")
//document.write("<div id='warmap' style='position:absolute; left:150px; top:83px;  z-index:50'></div>")

 }  
loc=window.location.href;
//alert(loc)
//ll=document.block.getElementsByTagName(table);

function printSatp(){
if(document.all)
{
topbar.style.visibility="hidden"
satp.style.visibility="hidden"
search.style.visibility="hidden"
}
else{
document.getElementById("topbar").style.visibility ="hidden";
document.getElementById("satp").style.visibility ="hidden";
document.getElementById("search").style.visibility ="hidden";
}
aReturn=block.getElementsByTagName("tr");

loc1=aReturn[2].innerHTML
PFW = window.open("","popFrameless","height=390, width=670,resizable=1,menubar=yes,toolbar=1,scrollbars=1");
//PFW.blur();
//window.focus();
var frameString=""+
"<html>"+
"<head>"+
"<title>"+loc+"</title><link rel='stylesheet' href='"+lctn+"Templates/satp.css'>"+
"</head>"+
"<body>"+
loc1+
"</body>"+
"</html>"
PFW.document.open();
PFW.document.write(frameString);
PFW.document.close();
//window.open(lctn1+"print.asp?id="+loc,'','')
//alert(block.innerHTML)
//window.print()
}

function myfunction(txt)
{
	if(txt=="print1")
	{
  	prn.style.visibility="hidden";
	}
	else if(txt=="print2")
	{
	prn1.style.visibility="hidden";
	}

     var disp_setting="toolbar=yes,location=no,directories=yes,menubar=yes,  "; 
     disp_setting+="scrollbars=yes,width=650, height=600, left=100, top=25"; 
     var content_vlue = document.getElementById(txt).innerHTML; 

  var docprint=window.open("","",disp_setting); 
   docprint.document.open(); 
   docprint.document.write('<html><head><title>South Asia Intelligence Review (SAIR)</title> '); 
  docprint.document.write('</head><body><p align="justify"> <font  name="arial" size="2" color="000000"> ');          
   docprint.document.write(content_vlue);          
   docprint.document.write('</p></font></body></html>'); 
   docprint.document.close(); 
  // docprint.focus(); 
  
}

function TellFriend()
{ 
var str="toolbar=no,status=no,menubar=no,location=no,scrollbars=yes,resizable=yes,height=300,width=423"
	tellaFriend = window.open("http://satp.org/satporgtp/sair/mail/mailto.asp","TellObj",str);
    tellaFriend.opener = top;
} 


function formsubmit() {
document.searchbox.submit()
}
function Gosearch()
{
if(document.searchbox.keyword.value == "")
	{
		alert("Please enter the keyword for the search");
    	    document.searchbox.keyword.select();
		return false;
	}
	document.searchbox.action=lctn+"MISsearch.asp";
	}

function Gosearch2()
{	
	
	b=document.searchbox2.date3.value;
	r1=document.searchbox2.date3.value.length;
	l=document.searchbox2.date3.value.length;
	yy=b.substr(0,4);
	yy=parseInt(yy)
	e=document.searchbox2.date3.value.indexOf("/");
		d=b.substr(5,r1);	
		c=d.indexOf("/");
		r1=d.length;
		r1=r1-1
	mm1=d.substr(0,c);
		//mm=parseInt(mm)
		if(mm1.indexOf("0")==-1)
	{
		mm=parseInt(mm1)
				}
	else
	{
		if(mm1.indexOf("0")>0)
	{
		mm=parseInt(mm1)
	}
		else
		{
			
		mm=mm1.substr(1,1)
		mm=parseInt(mm)
			
		}
	}
		
		c=c+1
		r1=r1-1
	
	dd1=d.substr(c,r1);
	if(dd1.indexOf("0")==-1)
	{
		dd=parseInt(dd1)
				}
	else
	{
		if(dd1.indexOf("0")>0)
	{
		dd=parseInt(dd1)
	}
		else
		{
		dd=dd1.substr(1,1)
		dd=parseInt(dd)
		}
	}
	if(document.searchbox2.date3.value == "")
	{
		alert("Please enter the date for Terrorism Update");
    	    document.searchbox2.date3.select();
		return false;
	}
		if(l>10)
		{
		alert ("Date Format must be YYYY/MM/DD")
			document.searchbox2.date3.select();
		return false;
		}
	
	if(e!=4)
		{
		alert ("Year must be YYYY")
			document.searchbox2.date3.select();
		return false;
		}
if(yy>=2000)
{
if(!((yy==2000)&& (mm<3)))
{
	if((mm>0) && (mm<13))
	{
		if((dd>0) && (dd<32))
		{
				if(mm==2)
			{
					if(((yy%4)>0) && (dd>28))
					{
					alert("Invalid date  should be <=28 for Feburary");
					document.searchbox2.date3.select();
					return false;
					}
					else if (dd>29)
					{
					alert("Invalid date should be <=29 for Feburary");
					document.searchbox2.date3.select();
						return false;
					}
			}
			 if( (mm==4 || mm==6 || mm==9 || mm==11) && (dd>30))
				{	
					alert("Invalid date should be <=30 for Month you had selected");
					document.searchbox2.date3.select();
					return false;
				}
			
		}
	else
		{
	alert("Invalid date should be <=31for Month you had selected");
	document.searchbox2.date3.select();
		return false;
		}
}
else
		{
	alert("Invalid Month should be <=12");
	document.searchbox2.date3.select();
		return false;
		}
		document.searchbox2.action=lctn+"detailed_news3.asp";
}
else
		{
	alert("Archives are Available From March 2000 to till Date");
	document.searchbox2.date3.select();
		return false;
	}
}
else
		{
	alert("Archives are Available From March 2000 to till Date");
	document.searchbox2.date3.select();
		return false;
	}
}


function Gosearch1()
{	b=document.searchbox1.date1.value;
	r1=document.searchbox1.date1.value.length;
	l=document.searchbox1.date1.value.length;
	yy=b.substr(0,4);
		yy=parseInt(yy)
	e=document.searchbox1.date1.value.indexOf("/");
		d=b.substr(5,r1);	
		c=d.indexOf("/");
		r1=d.length;
		r1=r1-1
	mm1=d.substr(0,c);
		//mm=parseInt(mm)
		if(mm1.indexOf("0")==-1)
	{
		mm=parseInt(mm1)
				}
	else
	{
		if(mm1.indexOf("0")>0)
	{
		mm=parseInt(mm1)
	}
		else
		{
			
		mm=mm1.substr(1,1)
		mm=parseInt(mm)
			
		}
	}
		
		c=c+1
		r1=r1-1
	
	dd1=d.substr(c,r1);
	if(dd1.indexOf("0")==-1)
	{
		dd=parseInt(dd1)
				}
	else
	{
		if(dd1.indexOf("0")>0)
	{
		dd=parseInt(dd1)
	}
		else
		{
		dd=dd1.substr(1,1)
		dd=parseInt(dd)
		}
	}
if(document.searchbox1.keyword.value == "")
	{
		alert("Please enter the keyword for the search");
    	    document.searchbox1.keyword.select();
		return false;
	}
	
		if(l>10)
		{
		alert ("Date Format must be YYYY/MM/DD")
			document.searchbox1.date1.select();
		return false;
		}
	
	if(e!=4)
		{
		alert ("Year must be YYYY")
			document.searchbox1.date1.select();
		return false;
		}

if((mm>0) && (mm<13))
{
	if((dd>0) && (dd<32))
	{
		if(mm == 2)
			{
				if(yy % 4>0 && dd>28)
					{
					alert("Invalid date  should be <=28 for Feburary");
					document.searchbox1.date1.select();
					return false;
					}
					else if (dd>29)
					{
					alert("Invalid date should be <=29 for Feburary");
					document.searchbox1.date1.select();
						return false;
					}
			}
			if((mm==4 || mm==6 || mm==9 ||  mm==11) && dd>30)
				{	
					alert("Invalid date should be <=30 for Month you had selected");
					document.searchbox1.date1.select();
					return false;
				}
			
		}
	else
		{
	alert("Invalid date should be <=31for Month you had selected");
	document.searchbox1.date1.select();
		return false;
		}
}
else
		{
	alert("Invalid Month should be <=12");
	document.searchbox1.date1.select();
		return false;
		}
		b=document.searchbox1.date2.value;
	r1=document.searchbox1.date2.value.length;
	l=document.searchbox1.date2.value.length;
	yy=b.substr(0,4);
	yy=parseInt(yy)
	e=document.searchbox1.date2.value.indexOf("/");
		d=b.substr(5,r1);	
		c=d.indexOf("/");
		r1=d.length;
		r1=r1-1
	mm1=d.substr(0,c);
		//mm=parseInt(mm)
		if(mm1.indexOf("0")==-1)
	{
		mm=parseInt(mm1)
				}
	else
	{
		if(mm1.indexOf("0")>0)
	{
		mm=parseInt(mm1)
	}
		else
		{
			
		mm=mm1.substr(1,1)
		mm=parseInt(mm)
			
		}
	}
		
		c=c+1
		r1=r1-1
	
	dd1=d.substr(c,r1);
	if(dd1.indexOf("0")==-1)
	{
		dd=parseInt(dd1)
				}
	else
	{
		if(dd1.indexOf("0")>0)
	{
		dd=parseInt(dd1)
	}
		else
		{
		dd=dd1.substr(1,1)
		dd=parseInt(dd)
		}
	}
	if(l>10)
		{
		alert ("Date Format must be YYYY/MM/DD")
			document.searchbox1.date2.select();
		return false;
		}
	
	if(e!=4)
		{
		alert ("Year must be YYYY")
			document.searchbox1.date2.select();
		return false;
		}

if((mm>0) && (mm<13))
{
	if((dd>0) && (dd<32))
	{
		if(mm == 2)
			{
				if(yy % 4>0 && dd>28)
					{
					alert("Invalid date  should be <=28 for Feburary");
					document.searchbox1.date2.select();
					return false;
					}
					else if (dd>29)
					{
					alert("Invalid date should be <=29 for Feburary");
					document.searchbox1.date2.select();
						return false;
					}
			}
			 if( (mm==4 || mm==6 || mm==9 || mm==11) && dd>30)
				{	
					alert("Invalid date should be <=30 for Month you had selected");
					document.searchbox1.date2.select();
					return false;
				}
			
		}
	else
		{
	alert("Invalid date should be <=31for Month you had selected");
	document.searchbox1.date2.select();
		return false;
		}
}
else
		{
	alert("Invalid Month should be <=12");
	document.searchbox1.date2.select();
		return false;
		}
	document.searchbox1.action=lctn+"search_news.asp";
}
function down()
{
	if(document.bigmap.complete)
	{
		
if (flag==1)
	{
	clearInterval(b);
	flag=0
	}
if(document.all)
{
	if(quickBar== "terror")
 {
warmap.style.visibility="hidden";
 }
test.style.visibility="visible"
test1.style.visibility="visible"
}
else{
	if(quickBar== "terror")
 {
document.getElementById("warmap").style.visibility ="hidden";
 }
document.getElementById("test").style.visibility ="visible";
document.getElementById("test1").style.visibility ="visible";
}

a=setInterval("downer()",50);

	}
		else
	{
			alert("Download is incomplete. Refresh Your Page.")
				}
}



function downer()
{
if(document.all)
{
ht=parseInt(test.style.height);
ht1=parseInt(test1.style.top);
//alert(ht1)
}
else
{
ht=parseInt(document.getElementById("test").style.height);
ht1=parseInt(document.getElementById("test1").style.top);
}
if (ht<380)
{

ht=ht+5;
ht1=ht1+5;
if(document.all)
{
test1.style.top=ht1;
test.style.height=ht;
}
else
{
document.getElementById("test").style.height=ht + "px";
document.getElementById("test1").style.top=ht1 + "px";
}
}
else
	{
if(document.all)
crosser.style.visibility="visible";
else
document.getElementById("crosser").style.visibility="visible";
clearInterval(a)
	}
}
