/******************************************************************************
* functions.js							      	      *
*                                                                             *
* Copyright 2005 by Indiantelevision.com				      *
* Visit http://www.indiantelevision.com					      *
*                                                                             *
* Provides functions for the website which will work on both Netscape	      *
* Communicator and Internet Explorer browsers (version 5.5 and up).  	      *
*									      *
******************************************************************************/
var mamadtemplateht="1500";
var mamcenterfirstht="75";
var mamcentersecondht="75";
var mamcenterthirdht="75";
var mamcenterfourthht="75";
var headlinescenterfirstht="75";
var headlinescentersecondht="75";
var headlinescenterthirdht="75";
var headlinesadtemplateht="1400";
var execdostemplateht="1500";
var playheadlineintertstitial="0";

//-----------------------------------------------------------------------------
// Print Window Script
//-----------------------------------------------------------------------------

function printWindow(){
browserVersion = parseInt(navigator.appVersion)
if (browserVersion >= 4) window.print()
}

//-----------------------------------------------------------------------------
// Comment On Story Script
//-----------------------------------------------------------------------------

function get_coment() {
window.open('/comment_story/storycomment.php?story_prop='+document.title+'&story_link='+document.location,'comm','height=380 width=450,status=1,resizable=0,scrollbar=0 resizable=0')  
window.opener = self;
}


//-----------------------------------------------------------------------------
// Read Comment On Story Script
//-----------------------------------------------------------------------------

function get_coment_read() {
window.open('/comment_story/view_spel_story.php?story_spe='+document.location,'comm','status=1,resizable=1,scrollbar=0')  
window.opener = self;
}

//-----------------------------------------------------------------------------
// Email Story Script
//-----------------------------------------------------------------------------

function get_path(){
str = location.pathname; 
window.open('/mailto/mail_friend.php4?link='+str.substring(1),'comm','height=500 width=500,top=10,left=150,status=1,resizable=0,scrollbar=0,resizable=0')  
}

//-----------------------------------------------------------------------------
// Date Script
//-----------------------------------------------------------------------------

function current_date()
{
var day=new Array();
day[0]="Sunday";day[1]="Monday";day[2]="Tuesday";day[3]="Wednesday";day[4]="Thursday";day[5]="Friday";day[6]="Saturday";
var months=new Array(13);
months[0]="January";
months[1]="February";
months[2]="March";
months[3]="April";
months[4]="May";
months[5]="June";
months[6]="July";
months[7]="August";
months[8]="September";
months[9]="October";
months[10]="November";
months[11]="December";
var time=new Date();
var lmonth=months[time.getMonth()];
var tday=day[time.getDay()];
var date=time.getDate();
var year=time.getYear();
if (year < 2000)
year = year + 1900;
document.write("<table border='0' width='95%' height='0'><tr><td align='right'><b> <font color='#000000' face='tahoma' size=1>"+tday+" "+date+" "+lmonth+" "+year+"</font> </b></td></tr></table>");
}

//-----------------------------------------------------------------------------
// Footer Script
//-----------------------------------------------------------------------------

function footer()
{
document.write("<table width='100%' border='0' cellspacing='0' cellpadding='0' align='center'>");
document.write("<tr><td colspan='4' align='center'><a class='footertxt' href='/exec_life/index.htm' target='_blank' >Home</a></td></tr>");
document.write("<tr><td colspan='4' height='5'></td></tr>");
document.write("<tr><td colspan='4' align='center' class='footertxt' ><a class='footertxt' href='javascript:get_path()'>Email this page</a> | ");
document.write("<a class='footertxt' href='javascript:printWindow()' >Print this page</a> | ");
document.write("<a class='footertxt' href='/exec_life/archives/index.htm' target='_blank'>Archives</a> | ");
document.write("<a class='footertxt' href='/disclaimer.htm#disclaim' target='_blank' >Disclaimer</a> | ");
document.write("<a class='footertxt' href='/interactive/bbs/indtv_views/indthinkadd.htm' target='_blank' >Feedback</a> | ");
document.write("</div></td></tr>");
document.write("<tr><td colspan='4' height=5></td></tr>");
document.write("<tr><td colspan='4' align='center'><a class='footertxt' href='http://www.indiantelevision.com' target='_blank'>Indiantelevision.com</a></div></td></tr>");
document.write("<td height=40 colspan='4' align='center' valign='middle'><font size='2' color='#94AFC3'<b>Copyright 2006 Indian Television Dot Com Pvt Ltd.All Rights Reserved.</font>");
document.write("<tr height='5'><td colspan='4' align='center'></td></tr>");
document.write("</td></tr>");
document.write("</table>");
document.write("</td></tr>");
document.write("</table>");
}

//-----------------------------------------------------------------------------
// Dynamic "Also Read:" script for all templates
//-----------------------------------------------------------------------------

function alsoread(val)
{

var display = "";
var a1 = "- <a class='alsoread' href='http://www.indiantelevision.com/special/boxpopuli/boxindex.htm' target='_blank'>Subhash Jha's Box Populi</a>";
var a2 = "- <a class='alsoread' href='http://www.indiantelevision.com/special/tellyscope/tscope_index.htm' target='_blank'>Telly Scope</a>";

if(val.indexOf("tab1") <0)
	display = display + a1;

if(val.indexOf("tab2") < 0)
	if (display.length>0)
		display = display + " <br> " + a2;
	else
		display = display + a2;	

document.write(display);
//var incs="<br><br><iframe name='I1' marginwidth='1' marginheight='0' height='295' width='150' src='/includes/fc.php' scrolling='no' border='0' frameborder='0'>Iframe</iframe>";
//document.write(incs);

}

//-----------------------------------------------------------------------------
// Index Footer Script
//-----------------------------------------------------------------------------

function index_footer()
{
document.write("<table width='100%' border='0' cellspacing='0' cellpadding='0' align='center' top='50'>");
//document.write("<tr><td height=2 bgcolor='#7CD3E7' colspan='4'></td></tr>");
document.write("<tr><td colspan='4'><HR width='95%' color='#7CD3E7' size='2'></td></tr>");
document.write("<tr class='footertxt'><td colspan='4'><div align='center'><a href='http://www.indiantelevision.com/' target='_blank' >Indiantelevision.com</a></div></td></tr>");
document.write("<tr class='commentbold_1'><td colspan='4' height='5'></td></tr>");
document.write("<tr class='commentbold_1'><td colspan='4'><div align='center'><a href='javascript:get_path()'>Email this page</a> | ");
document.write("<a href='javascript:printWindow()' >Print this page</a> | ");
document.write("<a href='/archives-index.htm' target='_blank'>Archives</a> | ");
document.write("<a href='http://www.indiantelevision.com/special/boxpopuli/boxindex.htm' target='_blank' >Subhash Jha`s Box Populi</a> | ");
document.write("<a href='disclaimer.php' target='_blank' >Disclaimer</a> | ");
document.write("<a href='feedback.php' target='_blank' >Feedback</a>");
document.write("</div></td></tr><br>");
document.write("<tr class='commentbold_1'><td colspan='4' height=5></td></tr>");
document.write("<tr><td colspan='4'><div align='center'><font color='#666666' size='2'>");
document.write("Conceived, created and maintained by <a href='http://www.indiantelevision.com/index.htm' target='_blank'>Indiantelevision Dot Com Pvt. Ltd.</a><br>");
document.write("Copyright 2006 All rights reserved.<br>");
document.write("This site is hosted by <a href='http://www.aquariuswebhosting.com' target='_blank'>Aquarius Web Hosting Pvt. Ltd, India. </a><br>");
document.write("</font></td></tr>");
document.write("<tr><td>&nbsp;</td></tr>");
document.write("</table>");
}

//-----------------------------------------------------------------------------
// Archive Footer Script
//-----------------------------------------------------------------------------

function arc_footer()
{
document.write("<table width='100%' border='0' cellspacing='0' cellpadding='0' align='center'>");
document.write("<tr><td colspan='4' align='center'><a class='commentbold' href='/' target='_blank' >Telly Chakkar Home</a> | ");
document.write("<a class='commentbold' href='javascript:get_path()'>Email this page</a> | ");
document.write("<a class='commentbold' href='javascript:printWindow()' >Print this page</a> | ");
document.write("<a class='commentbold' href='disclaimer.php' target='_blank' >Disclaimer</a> | ");
document.write("<a class='commentbold' href='feedback.php' target='_blank' >Feedback</a> | ");
document.write("<a class='commentbold' href='/archives-index.htm' target='_blank'>Archives</a> | ");
document.write("<a href='http://www.indiantelevision.com/special/boxpopuli/boxindex.htm' target='_blank' class='commentbold'>Subhash Jha`s Box Populi</a> | ");
document.write("<a class='commentbold' href='/forum' target='_blank'>Telly Chakkar Forums</a>");
document.write("</div></td></tr>");
document.write("<tr><td colspan='4' height=5></td></tr>");
document.write("<tr><td colspan='4' align='center'><a class='commentbold' href='/index.htm' target='_blank'>Indiantelevision.com</a></div></td></tr>");
document.write("</table><br>");
}


//-----------------------------------------------------------------------------
// blend Effect function -starts here
//-----------------------------------------------------------------------------

var imageholder=new Array()
var ie=document.all
var slidespeed=1000
var whichlink=0
var whichimage=0

function ImagePath(slideimages)
{

for (i=0;i<slideimages.length;i++)
{
	imageholder[i]=new Image()
	imageholder[i].src=slideimages[i]
}
}
function slideit()
{
	if (!document.images) return
	if (ie) document.images.slide.filters[0].apply()
		document.images.slide.src=imageholder[whichimage].src
	if (ie) document.images.slide.filters[0].play()
	whichlink=whichimage
	whichimage=(whichimage<slideimages.length-1)? whichimage+1 : 0
	setTimeout("slideit()",slidespeed+blenddelay)
}

//-----------------------------------------------------------------------------
// blend Effect function -ends here
//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------
// Disabling of Right Click on Images - starts here
//-----------------------------------------------------------------------------
var clickmessage='Copyright 2006 Indian Television Dot Com Pvt Ltd  and/or its licensors. No use without permission. Contact enquiries@indiantelevision.com'
function disableclick(e) {
if (document.all) {
		if (event.button==2||event.button==3) {
		if (event.srcElement.tagName=='IMG'){
		alert(clickmessage);
		return false;
		}
		}
	} else if (document.layers) {
		if (e.which == 3) {
		alert(clickmessage);
		return false;
		}
	} else if (document.getElementById) {
		if (e.which==3&&e.target.tagName=='IMG'){
		alert(clickmessage)
		return false;
		}
		}
}
function associateimages() {
		for(i=0; i<document.images.length;i++) {
			document.images[i].onmousedown=disableclick;
		}
}
if (document.all) {
document.onmousedown=disableclick
} else if (document.getElementById) {
document.onmouseup=disableclick
} else if (document.layers) {
associateimages()
}


//-----------------------------------------------------------------------------
// Disabling of Right Click on Images - ends here
//-----------------------------------------------------------------------------

var locat='/images/ratings/rating.php?';

function rate(art,im)
{

	document.write("<table border='1' width='267' align='center' cellpadding='0' cellspacing='0'>");
	document.write("<tr bgcolor='#000000' align='center' bordercolor='#000000'>");
	document.write("<td height='24'><font face='Georgia, Times New Roman, Times, serif' size='5' color='#FFFFFF'>Rate This Show</font></td>");
	document.write("</tr>");

	document.write("<tr bgcolor='#000000' align='center' bordercolor='#000000'>");
	document.write("<td colspan='2'><img src='/images/ratings/wow.jpg' width='55' height='30' onclick='sub(1)' name='rate' value='1' style='cursor:hand;'><img src='/images/ratings/ho-hum.jpg' width='83' height='30' style='cursor:hand;' onclick='sub(2)'><img src='/images/ratings/ugh.jpg' width='60' height='30' style='cursor:hand;' onclick='sub(3)'><img src='/images/ratings/zzz.jpg' width='55' height='30' style='cursor:hand;' onclick='sub(4)'></td>");
	document.write("</tr>");
	document.write("</table>");
	locat='/images/ratings/rating.php?url='+art+'&im='+im;
	
}

function sub(x)
{
	locat=locat+'&rate='+x;
	window.open(locat,'hi', 'width=350,height=300,resizable=0,scrollbars=0');
}

function win()

{

window.open("/poll/poll.php", "tellychakkar" , "width=330 height=390 scrollbar=no resizable=no menubar=no");

}


var locat_new='/ratings_new/rating_new.php?';

function rate_new(art,im,ttl)
{
document.write("<form name='ratings'>");
//document.write("<input type='hidden' value='<? echo $PHP_SELF; ?>' name='url'>");
document.write("<table width='488' border='0' cellspacing='0' cellpadding='0' height='100'>");
  document.write("<tr> ");
    document.write("<td bgcolor='87E2D0'> ");
      document.write("<table width='90%' border='0' cellspacing='0' cellpadding='0' align='center'>");
        document.write("<br>");
        document.write("<tr bgcolor='#FDE2C8' valign='top'> ");
          document.write("<td colspan='2' bgcolor='#CDF3EC'> ");
            document.write("<table width='100%' border='0' cellspacing='0' cellpadding='0' align='center' height='95'>");
              document.write("<tr> ");
                document.write("<td width='82%' height='10' valign='top'></td>");
              document.write("</tr>");
              document.write("<tr> ");
                document.write("<td valign='top' bgcolor='#FFFFFF'> </td>");
              document.write("</tr>");
              document.write("<tr> ");
                document.write("<td valign='top' bgcolor='#FFFFFF'> ");
                  document.write("<div align='center'> </div>");
                  document.write("<table width='100%' border='0' cellspacing='0' cellpadding='0' align='center'>");
                    document.write("<tr> ");
                      document.write("<td colspan='4'> ");
                        document.write("<table width='100%' border='0' cellspacing='0' cellpadding='0'>");
                          document.write("<tr> ");
                            document.write("<td colspan='6'><img src='/ratings_new/rate.jpg' width='336' height='30'></td>");
                          document.write("</tr>");
                          document.write("<tr> ");
                            document.write("<td width='14%' height='7'> ");
                              document.write("<input type='radio' name='rate' value='1'>");
                            document.write("</td>");
                            document.write("<td width='18%' height='7'> ");
                              document.write("<input type='radio' name='rate' value='2'>");
                            document.write("</td>");
                            document.write("<td width='17%' height='7'> ");
                              document.write("<input type='radio' name='rate' value='3'>");
                            document.write("</td>");
                            document.write("<td width='16%' height='7'> ");
                              document.write("<input type='radio' name='rate' value='4'>");
                            document.write("</td>");
                            document.write("<td colspan='2' height='7'><font face='Verdana, Arial, Helvetica, sans-serif' size='1'>Your ");
                            document.write("  Email here </font></td>");
                          document.write("</tr>");
                          document.write("<tr> ");
                            document.write("<td width='14%' height='2' valign='middle'><img src='/ratings_new/wow.jpg' width='69' height='30'></td>");
                            document.write("<td width='18%' height='2'> ");
                              document.write("<p><img src='/ratings_new/ho-hum.jpg' width='90' height='30'></p>");
                            document.write("</td>");
                            document.write("<td width='17%' height='2'><img src='/ratings_new/ugh.jpg' width='67' height='30'></td>");
                            document.write("<td width='16%' height='2'><img src='/ratings_new/zzz.jpg' width='71' height='30'></td>");
                            document.write("<td width='25%' height='2'> ");
                              document.write("<input type='text' name='email'>");
                            document.write("</td>");
                            document.write("<td width='10%' height='2'> ");
                              document.write("<input type='button' value='Go' onClick='validate()'>");
                            document.write("</td>");
                          document.write("</tr>");
                        document.write("</table>");
                      document.write("</td>");
                    document.write("</tr>");
                  document.write("</table>");
                document.write("</td>");
              document.write("</tr>");
              document.write("<tr> ");
                document.write("<td width='82%' height='10' valign='top'></td>");
              document.write("</tr>");
            document.write("</table>");
          document.write("</td>");
        document.write("</tr>");
      document.write("</table>");
    document.write("</td>");
  document.write("</tr>");
document.write("</table>");
document.write("</form>");
	
locat_new='/ratings_new/rating_new.php?url='+art+'&im='+im+'&ttl='+ttl;
	
}

function validate()
{
	if(document.all.ratings.email.value=="")
	{
		alert("Please enter the email id");
	}
	else if(emailCheck(document.all.ratings.email.value)!="Valid")
	{
		alert("Please enter valid email id");
	}
	else
	{
		var val=0;
		if(document.all.ratings.rate[0].checked) val=1;

		if(document.all.ratings.rate[1].checked) val=2;

		if(document.all.ratings.rate[2].checked) val=3;

		if(document.all.ratings.rate[3].checked) val=4;
	
		sub_new(val,document.all.ratings.email.value);
		
	}
	
}

function sub_new(x,email)
{
	locat_new=locat_new+'&rate='+x+'&email='+email;
	window.open(locat_new,'hi', 'width=350,height=300,resizable=0,scrollbars=0');
}


function emailCheck (emailStr) { 
        var checkTLD=1;
        var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
        var emailPat=/^(.+)@(.+)$/;
        var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
        var validChars="\[^\\s" + specialChars + "\]";
        var quotedUser="(\"[^\"]*\")";
        var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
        var atom=validChars + '+';
        var word="(" + atom + "|" + quotedUser + ")";
        var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
        var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
        var matchArray=emailStr.match(emailPat);
        if (matchArray==null) {
                return "Email address is invalid";
                //return ;
        }

        var user=matchArray[1];
        var domain=matchArray[2];
        for (i=0; i<user.length; i++) {
                if (user.charCodeAt(i)>127) {
                        return "Ths username contains invalid characters.";
                        //return ;
                   }
        }
        for (i=0; i<domain.length; i++) {
                if (domain.charCodeAt(i)>127) {
                        return "Ths domain name contains invalid characters.";
                        //return ;
                  }
        }
        if (user.match(userPat)==null) {
                return "The username doesn't seem to be valid.";
                //return ;
        }
        var IPArray=domain.match(ipDomainPat);
        if (IPArray!=null) {
                for (var i=1;i<=4;i++) {
                        if (IPArray[i]>255) {
                                return "Destination IP address is invalid!";
                                //return ;
                         }
                }
                return "Valid";
        }
        var atomPat=new RegExp("^" + atom + "$");
        var domArr=domain.split(".");
        var len=domArr.length;
        for (i=0;i<len;i++) {
                if (domArr[i].search(atomPat)==-1) {
                        return "The domain name does not seem to be valid.";
                        //return ;
                 }
        }

        if (checkTLD && domArr[domArr.length-1].length!=2 && domArr[domArr.length-1].search(knownDomsPat)==-1) {
                return "The address must end in a well-known domain or two letter " + "country.";
                //return ;
        }

        if (len<2) {
                return "This address is missing a hostname!";
                //return ;
        }
        return "Valid";
}

//-----------------------------------------------------------------------------
// Get your friends to read Tellychakkar.com! -  Starts Here
//-----------------------------------------------------------------------------

function fnmail()
{
document.writeln(" <table border='0' cellspacing='0' cellpadding='0' bgcolor='#FFFFFF' bordercolor='#000000'>");
document.writeln("<tr><td bgcolor='#FFFFFF'>");
document.writeln("<div align='center'><font size='1' face='Verdana, Arial, Helvetica, sans-serif'><b><font size='2' face='Arial, Helvetica, sans-serif' color='#CC0000'>");
document.writeln("Get your friends to read Tellychakkar.com!</font><font size='2' face='Arial, Helvetica, sans-serif' color='#003366'><br>");
document.writeln("</font></b><font size='2' face='Arial, Helvetica, sans-serif' color='#003366'>");
document.writeln("<font color='#000000'>Fill in 5 email addresses of people who you feel would like to read Telly Chakkar</font><font color='#FF0000'>...</font></font></font></div>");
document.writeln("</td> </tr>");
document.writeln("<tr> <td align=\"center\"><br><font size='2' face='Arial, Helvetica, sans-serif' color='#003366'>");
document.writeln("<form name='form1' >");
document.writeln("&nbsp;Your Email:&nbsp;<input type='text' name='email' size='20'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='hidden' name='feedback' size='40'><BR><font size='-4'>&nbsp;</font><br>Referred Emails :- <br>");
document.writeln("<input type='text' name='email1' size='13'><input type='text' name='email2' size='13'><input type='text' name='email3' size='13'><input type='text' name='email4' size='13'><input type='text' name='email5' size='13'><input type='button' name='Submit' value='Ok' onclick='thanks()'>");
document.writeln(" </font></form>");
document.writeln("</td></tr>");
document.writeln("</table>");
}

function thanks()
{
	var txt=document.all.form1;
	loc="/js/confirm.php?feedback="+txt.feedback.value+"&email="+txt.email.value+"&email1="+txt.email1.value+"&email2="+txt.email2.value+"&email3="+txt.email3.value+"&email4="+txt.email4.value+"&email5="+txt.email5.value;

	window.open(loc,'hi', 'width=600,height=20,resizable=0,scrollbars=0');
}

//-----------------------------------------------------------------------------
// Get your friends to read Tellychakkar.com! -  Ends Here
//-----------------------------------------------------------------------------


//-----------------------------------------------------------------------------
// Get your friends to read Indiantelevision.com! -  Starts Here
//-----------------------------------------------------------------------------

function fnmail_itv()
{
document.writeln(" <table align='center' border='1' cellspacing='0' cellpadding='0' bgcolor='#FFFFFF' bordercolor='red' width=\"95%\">");
document.writeln("<tr><td bgcolor='#FFFFFF'>");
document.writeln(" <table align='center' border='0' cellspacing='0' cellpadding='0' bgcolor='#FFFFFF' >");
document.writeln("<tr><td bgcolor='#FFFFFF'>");
document.writeln("<div align='center'><font size='1' face='Verdana, Arial, Helvetica, sans-serif'><b><font size='2' face='Arial, Helvetica, sans-serif' color='#999999'>");
document.writeln("Get your peers to read </font><font size='2' face='Verdana, Arial, Helvetica, sans-serif'><b>Indiantelevision.</b></font><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='red'>com!</font><font size='2' face='Arial, Helvetica, sans-serif' color='#003366'><br>");
document.writeln("</font></b><font size='2' face='Arial, Helvetica, sans-serif' color='#003366'>");
document.writeln("<font color='#000000'>Fill in 5 email addresses of people who you feel would like to read Indiantelevision.Com</font><font color='#FF0000'>...</font></font></font></div>");
document.writeln("</td> </tr>");
document.writeln("<tr> <td align=\"center\"><br><font size='2' face='Arial, Helvetica, sans-serif' color='#999999'>");
document.writeln("<form name='form1' >");
document.writeln("&nbsp;<b>Your Email:</b>&nbsp;<input type='text' name='email' size='12'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='hidden' name='feedback' size='40'><BR><font size='-4'>&nbsp;</font><br><b>Referred Emails :-</b> <br>");
document.writeln("<input type='text' name='email1' size='12'><input type='text' name='email2' size='12'><input type='text' name='email3' size='12'><BR><input type='text' name='email4' size='12'><input type='text' name='email5' size='12'><input type='button' name='Submit' value='Ok' onclick='thanks_itv()'>");

document.writeln(" </font></form>");
document.writeln("</td></tr>");
document.writeln("</table>");
document.writeln("</td></tr>");
document.writeln("</table>");
}

function thanks_itv()
{
	var txt=document.all.form1;
	loc="/js/confirm_indiantelevision.php?feedback="+txt.feedback.value+"&email="+txt.email.value+"&email1="+txt.email1.value+"&email2="+txt.email2.value+"&email3="+txt.email3.value+"&email4="+txt.email4.value+"&email5="+txt.email5.value;

	window.open(loc,'hi', 'width=600,height=20,resizable=0,scrollbars=0');
}

//-----------------------------------------------------------------------------
// Get your friends to read Indiantelevision.com! -  Ends Here
//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------
// Top 5 Searches code starts here
//------------------------------------------------------------------------------

function topsearches()
{
document.write("<tr align=\"left\"><td valign=\"middle\" height=\"4\"></td></tr>");
document.write("<tr align=\"left\"><td valign=\"middle\" height=\"2\"><table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"#4683A1\" class=\"search\">");
document.write("<tr><td width=\"22%\" height=\"20\"></td><td width=\"78%\" valign=\"middle\" class=\"titles\" height=\"20\">");
document.write("<a href="+link1+" class=\"titles\" target=\"_blank\">"+title1+"</a>");
document.write(" | <a href="+link2+" class=\"titles\" target=\"_blank\">"+title2+"</a>"); 
document.write(" | <a href="+link3+" class=\"titles\" target=\"_blank\">"+title3+"</a>"); 
document.write(" | <a href="+link4+" class=\"titles\" target=\"_blank\">"+title4+"</a>"); 
document.write(" | <a href="+link5+" class=\"titles\" target=\"_blank\">"+title5+"</a>");  
document.write('</td></tr></table></td></tr>');
}

//-----------------------------------------------------------------------------
// Top 5 Searches code ends here
//------------------------------------------------------------------------------

// -----------------------------------------------------------------------------
// START OF DATE FUNCTIONS
// -----------------------------------------------------------------------------
// These functions use the same 'format' strings as the 
// java.text.SimpleDateFormat class, with minor exceptions.
// The format string consists of the following abbreviations:
// 
// Field        | Full Form          | Short Form
// -------------+--------------------+-----------------------
// Year         | yyyy (4 digits)    | yy (2 digits), y (2 or 4 digits)
// Month        | MMM (name or abbr.)| MM (2 digits), M (1 or 2 digits)
//              | NNN (abbr.)        |
// Day of Month | dd (2 digits)      | d (1 or 2 digits)
// Day of Week  | EE (name)          | E (abbr)
// Hour (1-12)  | hh (2 digits)      | h (1 or 2 digits)
// Hour (0-23)  | HH (2 digits)      | H (1 or 2 digits)
// Hour (0-11)  | KK (2 digits)      | K (1 or 2 digits)
// Hour (1-24)  | kk (2 digits)      | k (1 or 2 digits)
// Minute       | mm (2 digits)      | m (1 or 2 digits)
// Second       | ss (2 digits)      | s (1 or 2 digits)
// AM/PM        | a                  |
//
// NOTE THE DIFFERENCE BETWEEN MM and mm! Month=MM, not mm!
// Examples:
//  "MMM d, y" matches: January 01, 2000
//                      Dec 1, 1900
//                      Nov 20, 00
//  "M/d/yy"   matches: 01/20/00
//                      9/2/00
//  "MMM dd, yyyy hh:mm:ssa" matches: "January 01, 2000 12:30:45AM"
// ------------------------------------------------------------------

var MONTH_NAMES=new Array('January','February','March','April','May','June','July','August','September','October','November','December','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
var DAY_NAMES=new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sun','Mon','Tue','Wed','Thu','Fri','Sat');
function LZ(x) {return(x<0||x>9?"":"0")+x}

// ------------------------------------------------------------------
// isDate ( date_string, format_string )
// Returns true if date string matches format of format string and
// is a valid date. Else returns false.
// It is recommended that you trim whitespace around the value before
// passing it to this function, as whitespace is NOT ignored!
// ------------------------------------------------------------------
function isDate(val,format) {
	var date=getDateFromFormat(val,format);
	if (date==0) { return false; }
	return true;
	}

// -------------------------------------------------------------------
// compareDates(date1,date1format,date2,date2format)
//   Compare two date strings to see which is greater.
//   Returns:
//   1 if date1 is greater than date2
//   0 if date1 is equal to date2
//   2 if date1 is less than date2
//  -1 if either of the dates is in an invalid format
// -------------------------------------------------------------------
function compareDates(date1,dateformat1,date2,dateformat2) {
	var d1=getDateFromFormat(date1,dateformat1);
	var d2=getDateFromFormat(date2,dateformat2);
	if (d1==0 || d2==0) {
		return -1;
		}
	else if (d1 > d2) {
		return 1;
		}
	else if (d1 < d2) {
		return 2;
		}
	else return 0;
	}

// ------------------------------------------------------------------
// formatDate (date_object, format)
// Returns a date in the output format specified.
// The format string uses the same abbreviations as in getDateFromFormat()
// ------------------------------------------------------------------
function formatDate(date,format) {
	format=format+"";
	var result="";
	var i_format=0;
	var c="";
	var token="";
	var y=date.getYear()+"";
	var M=date.getMonth()+1;
	var d=date.getDate();
	var E=date.getDay();
	var H=date.getHours();
	var m=date.getMinutes();
	var s=date.getSeconds();
	var yyyy,yy,MMM,MM,dd,hh,h,mm,ss,ampm,HH,H,KK,K,kk,k;
	// Convert real date parts into formatted versions
	var value=new Object();
	if (y.length < 4) {y=""+(y-0+1900);}
	value["y"]=""+y;
	value["yyyy"]=y;
	value["yy"]=y.substring(2,4);
	value["M"]=M;
	value["MM"]=LZ(M);
	value["MMM"]=MONTH_NAMES[M-1];
	value["NNN"]=MONTH_NAMES[M+11];
	value["d"]=d;
	value["dd"]=LZ(d);
	value["E"]=DAY_NAMES[E+7];
	value["EE"]=DAY_NAMES[E];
	value["H"]=H;
	value["HH"]=LZ(H);
	if (H==0){value["h"]=12;}
	else if (H>12){value["h"]=H-12;}
	else {value["h"]=H;}
	value["hh"]=LZ(value["h"]);
	if (H>11){value["K"]=H-12;} else {value["K"]=H;}
	value["k"]=H+1;
	value["KK"]=LZ(value["K"]);
	value["kk"]=LZ(value["k"]);
	if (H > 11) { value["a"]="PM"; }
	else { value["a"]="AM"; }
	value["m"]=m;
	value["mm"]=LZ(m);
	value["s"]=s;
	value["ss"]=LZ(s);
	while (i_format < format.length) {
		c=format.charAt(i_format);
		token="";
		while ((format.charAt(i_format)==c) && (i_format < format.length)) {
			token += format.charAt(i_format++);
			}
		if (value[token] != null) { result=result + value[token]; }
		else { result=result + token; }
		}
	return result;
	}
	
// ------------------------------------------------------------------
// Utility functions for parsing in getDateFromFormat()
// ------------------------------------------------------------------
function _isInteger(val) {
	var digits="1234567890";
	for (var i=0; i < val.length; i++) {
		if (digits.indexOf(val.charAt(i))==-1) { return false; }
		}
	return true;
	}
function _getInt(str,i,minlength,maxlength) {
	for (var x=maxlength; x>=minlength; x--) {
		var token=str.substring(i,i+x);
		if (token.length < minlength) { return null; }
		if (_isInteger(token)) { return token; }
		}
	return null;
	}
	
// ------------------------------------------------------------------
// getDateFromFormat( date_string , format_string )
//
// This function takes a date string and a format string. It matches
// If the date string matches the format string, it returns the 
// getTime() of the date. If it does not match, it returns 0.
// ------------------------------------------------------------------
function getDateFromFormat(val,format) {
	val=val+"";
	format=format+"";
	var i_val=0;
	var i_format=0;
	var c="";
	var token="";
	var token2="";
	var x,y;
	var now=new Date();
	var year=now.getYear();
	var month=now.getMonth()+1;
	var date=1;
	var hh=now.getHours();
	var mm=now.getMinutes();
	var ss=now.getSeconds();
	var ampm="";
	
	while (i_format < format.length) {
		// Get next token from format string
		c=format.charAt(i_format);
		token="";
		while ((format.charAt(i_format)==c) && (i_format < format.length)) {
			token += format.charAt(i_format++);
			}
		// Extract contents of value based on format token
		if (token=="yyyy" || token=="yy" || token=="y") {
			if (token=="yyyy") { x=4;y=4; }
			if (token=="yy")   { x=2;y=2; }
			if (token=="y")    { x=2;y=4; }
			year=_getInt(val,i_val,x,y);
			if (year==null) { return 0; }
			i_val += year.length;
			if (year.length==2) {
				if (year > 70) { year=1900+(year-0); }
				else { year=2000+(year-0); }
				}
			}
		else if (token=="MMM"||token=="NNN"){
			month=0;
			for (var i=0; i<MONTH_NAMES.length; i++) {
				var month_name=MONTH_NAMES[i];
				if (val.substring(i_val,i_val+month_name.length).toLowerCase()==month_name.toLowerCase()) {
					if (token=="MMM"||(token=="NNN"&&i>11)) {
						month=i+1;
						if (month>12) { month -= 12; }
						i_val += month_name.length;
						break;
						}
					}
				}
			if ((month < 1)||(month>12)){return 0;}
			}
		else if (token=="EE"||token=="E"){
			for (var i=0; i<DAY_NAMES.length; i++) {
				var day_name=DAY_NAMES[i];
				if (val.substring(i_val,i_val+day_name.length).toLowerCase()==day_name.toLowerCase()) {
					i_val += day_name.length;
					break;
					}
				}
			}
		else if (token=="MM"||token=="M") {
			month=_getInt(val,i_val,token.length,2);
			if(month==null||(month<1)||(month>12)){return 0;}
			i_val+=month.length;}
		else if (token=="dd"||token=="d") {
			date=_getInt(val,i_val,token.length,2);
			if(date==null||(date<1)||(date>31)){return 0;}
			i_val+=date.length;}
		else if (token=="hh"||token=="h") {
			hh=_getInt(val,i_val,token.length,2);
			if(hh==null||(hh<1)||(hh>12)){return 0;}
			i_val+=hh.length;}
		else if (token=="HH"||token=="H") {
			hh=_getInt(val,i_val,token.length,2);
			if(hh==null||(hh<0)||(hh>23)){return 0;}
			i_val+=hh.length;}
		else if (token=="KK"||token=="K") {
			hh=_getInt(val,i_val,token.length,2);
			if(hh==null||(hh<0)||(hh>11)){return 0;}
			i_val+=hh.length;}
		else if (token=="kk"||token=="k") {
			hh=_getInt(val,i_val,token.length,2);
			if(hh==null||(hh<1)||(hh>24)){return 0;}
			i_val+=hh.length;hh--;}
		else if (token=="mm"||token=="m") {
			mm=_getInt(val,i_val,token.length,2);
			if(mm==null||(mm<0)||(mm>59)){return 0;}
			i_val+=mm.length;}
		else if (token=="ss"||token=="s") {
			ss=_getInt(val,i_val,token.length,2);
			if(ss==null||(ss<0)||(ss>59)){return 0;}
			i_val+=ss.length;}
		else if (token=="a") {
			if (val.substring(i_val,i_val+2).toLowerCase()=="am") {ampm="AM";}
			else if (val.substring(i_val,i_val+2).toLowerCase()=="pm") {ampm="PM";}
			else {return 0;}
			i_val+=2;}
		else {
			if (val.substring(i_val,i_val+token.length)!=token) {return 0;}
			else {i_val+=token.length;}
			}
		}
	// If there are any trailing characters left in the value, it doesn't match
	if (i_val != val.length) { return 0; }
	// Is date valid for month?
	if (month==2) {
		// Check for leap year
		if ( ( (year%4==0)&&(year%100 != 0) ) || (year%400==0) ) { // leap year
			if (date > 29){ return 0; }
			}
		else { if (date > 28) { return 0; } }
		}
	if ((month==4)||(month==6)||(month==9)||(month==11)) {
		if (date > 30) { return 0; }
		}
	// Correct hours value
	if (hh<12 && ampm=="PM") { hh=hh-0+12; }
	else if (hh>11 && ampm=="AM") { hh-=12; }
	var newdate=new Date(year,month-1,date,hh,mm,ss);
	return newdate.getTime();
	}

// ------------------------------------------------------------------
// parseDate( date_string [, prefer_euro_format] )
//
// This function takes a date string and tries to match it to a
// number of possible date formats to get the value. It will try to
// match against the following international formats, in this order:
// y-M-d   MMM d, y   MMM d,y   y-MMM-d   d-MMM-y  MMM d
// M/d/y   M-d-y      M.d.y     MMM-d     M/d      M-d
// d/M/y   d-M-y      d.M.y     d-MMM     d/M      d-M
// A second argument may be passed to instruct the method to search
// for formats like d/M/y (european format) before M/d/y (American).
// Returns a Date object or null if no patterns match.
// ------------------------------------------------------------------
function parseDate(val) {
	var preferEuro=(arguments.length==2)?arguments[1]:false;
	generalFormats=new Array('y-M-d','MMM d, y','MMM d,y','y-MMM-d','d-MMM-y','MMM d');
	monthFirst=new Array('M/d/y','M-d-y','M.d.y','MMM-d','M/d','M-d');
	dateFirst =new Array('d/M/y','d-M-y','d.M.y','d-MMM','d/M','d-M');
	var checkList=new Array('generalFormats',preferEuro?'dateFirst':'monthFirst',preferEuro?'monthFirst':'dateFirst');
	var d=null;
	for (var i=0; i<checkList.length; i++) {
		var l=window[checkList[i]];
		for (var j=0; j<l.length; j++) {
			d=getDateFromFormat(val,l[j]);
			if (d!=0) { return new Date(d); }
			}
		}
	return null;
	}
// -----------------------------------------------------------------------------
// END OF DATE FUNCTIONS
// -----------------------------------------------------------------------------
