// Search Box Javascript
function formHandler(form){
var URL = document.form.site.options[document.form.site.selectedIndex].value;
window.location.href = URL;
}

// -- FOLLOWING IS IMPORTED FROM FRESNO BEE --

// GALLERY LAUNCHER 

function goGallery(url)  
{ 

 galleryWindow = window.open(url,'gallerypopup','status=no,width=650,height=700,scrollbars=yes,resizable=yes'); 

} 

// WEATHER SCRIPTS/FUNCTIONS
var default_zone="ACY";
function setwzone() {	// Does popup window for user to set preferred zone(s)
	getwzone = "http://newslink.nandomedia.com/cgi-bin/weather/findcode.cgi?camefrom=http://"+escape(location.hostname)+escape(location.pathname);
	setme = window.open(getwzone,"setwzone","status=yes,width=350,height=350,scrollbars=yes,resizable=no");
}
// SETS THE PREFERED ZONE FROM QUERY STRING, OR USES DEFAULT
if (document.location.search.substr(1,5)=="wzone") { //reads from url
	var wzone = document.location.search.substr(7);
} else { 
	wzone = default_zone;
}		
var dontdrawzonew="1";   //IMPORTANT: STOPS DEFAULT OUTPUT SO WE YOU CAN CUSTOMIZE
document.write('<scr' + 'ipt language="javascript" type="text/javascript" src="http://newslink.nandomedia.com/weather/data/current/' + wzone + '.js"></scr' + 'ipt>');// DECLAREING THE VARIABLES TO AVOID ERRORS IN EVENT OF TROUBLE
var mywzonename; var timelocal; var icon; var conditions; var temperature; var wind_chill; var humidity; var wind_from; var wind_speed; var visibility; var pressure; var fivedays; var icondesc;

function popup(mylink,windowName,width,height,windowFeatures)

{

if (! window.focus)return true;
var test = "'"; 
if (typeof(mylink) == 'string')

   href=mylink;

else

   href=mylink.href;

   

winLeft = (screen.width-width)/2; 

winTop = (screen.height-(height+110))/2; 

window.open(href,windowName,"width=" + width +",height=" + height + ",left=" + winLeft + ",top=" + winTop + test + windowFeatures + test);

return false;

}
				// Script Source: CodeLifter.com

// Copyright 2003

// Do not remove this notice.
// SETUPS:

// ===============================
// Set the horizontal and vertical position for the popup
PositionX = 100;

PositionY = 100;
// Set these value approximately 20 pixels greater than the

// size of the largest image to be used (needed for Netscape)
defaultWidth  = 320;

defaultHeight = 320;
// Set autoclose true to have the window close automatically

// Set autoclose false to allow multiple popup windows
var AutoClose = true;
// Do not edit below this line...

// ================================

if (parseInt(navigator.appVersion.charAt(0))>=4){

var isNN=(navigator.appName=="Netscape")?1:0;

var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}

var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;

var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;
function popImage(imageURL,imageTitle){

if (isNN){imgWin=window.open('about:blank','',optNN);}

if (isIE){imgWin=window.open('about:blank','',optIE);}

with (imgWin.document){

writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');

writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');

writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');

writeln('function reSizeToImage(){');writeln('if (isIE){');writeln('window.resizeTo(100,100);');

writeln('width=150-(document.body.clientWidth-document.images[0].width);');

writeln('height=100-(document.body.clientHeight-document.images[0].height);');

writeln('window.resizeTo(width,height);}');writeln('if (isNN){');       

writeln('window.innerWidth=document.images["George"].width;');writeln('window.innerHeight=document.images["George"].height;}}');

writeln('function doTitle(){document.title="'+imageTitle+'";}');writeln('</sc'+'ript>');

if (!AutoClose) writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')

else writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');

writeln('<img name="George" src='+imageURL+' style="display:block"></body></html>');

close();		

}}//Formated Date

function getFormatedDate() {

var mydate=new Date();
var months = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
//get month, value from 0 to 11

var monthnumber = mydate.getMonth();

var monthname = months[monthnumber];

var monthday = mydate.getDate();

var year = mydate.getYear();

if(year < 2000) { year = year + 1900; }

var dateString = monthname + ' ' + monthday + ', ' + year;

document.write(dateString);

}
//used to convert date in milliseconds to the format like this mm/dd/yyyy

function convDate(mydate) {
var browserVersion = navigator.appVersion;

var browserVersionNum = parseFloat(browserVersion);
if (browserVersionNum<4)

  {

    year=mydate.getYear();

    year="t" + year;                        // Convert to string

    year=year.substring(3,year.length);     // Get last two digits

    year="20" + year;                       // Good for 100 years (by then, JS 1.3 should be standard!)

  }

else

  {

    year=mydate.getFullYear();

  }

  

month=mydate.getMonth()+1;

day=mydate.getDate();

datestring=year+month+day;

if (day < 10) { day="0"+day; }

if (month < 10) { month="0"+month; }

mydate=month + "/" + day + "/" + year;

return mydate;
}




//search code

	function checkAff(obj)

	{

	// if dining or bars are selected in the dropdown, pass 17 as

	// the aff and the value of drop as the section, otherwise 

	// leave the section blank and pass the value of drop as the aff

	if (obj.drop.value == 'dining') {

		   obj.aff.value = '17';

		   obj.section.value = obj.drop.value;

	} else if (obj.drop.value == 'bars') {

		   obj.aff.value = '17';

		   obj.section.value = obj.drop.value;

   } else if (obj.drop.value == 'boats') {

	   obj.aff.value = '28';

	   obj.ft.value = 'a';

	   obj.priceRange.value = 'Any';

	   obj.makeModel.value = obj.keywords.value

	} else {

		   obj.aff.value = obj.drop.value;

		   obj.section.value = '';

	} 

	if (obj.drop.value == '2') {

		   obj.catId.value = '6947';

		   obj.aff.value = obj.drop.value;

	}

	}

	

	function submitform() {

	document.press_of_ac_search.submit();

    }

/* 
New search form submit javascript for removing PD search
*/

function searchFormSubmit(form) {
	// if this is an archive search
	if (form.aff.value == '1' || form.aff[1].checked == true) {
		window.location = "http://www.newslibrary.com/nlsearch.asp?search_mode=all&action=search&date_mode=year&year=last+10+years&sort=d%3Ah&nitems=10&region=AC&dbquery=" + form.keywords.value;
		return false;

	} else {
		form.sf_pubsys_story.value = form.keywords.value;
		form.submit();
		return false;
	}
	return true;
}

