/////////////////////////////

// CLEAR SEARCH AND LOGIN //

///////////////////////////

function clearSearch(){

	document.searchForm.keyword.value = "";

	return;

}

function clearLogin(){

	document.loginForm.login_name.value = "";

	document.loginForm.login_password.value = "";

	document.loginForm.login_name.focus();

	return;

}

function verifyTop() {

if ( document.loginForm.login_name.value == "" || document.loginForm.password.value == "" ) 
{
 	alert( "Please enter your Name and Password" );
 
 	return;
}
else 
   document.loginForm.submit();
}


//////////////////////////////

// QUICKPOLL LAYER THINGIE //

////////////////////////////

function layerGo( choice ) {

    document.QP_LAYER2.src = "/home/quick_poll_action.cfm?choice=" + choice;

  }
 

//////////////////////////////

// POP UP WINDOWS          //

////////////////////////////

function screenPop (image_number,total_images,article_id,path) {	
	
	var theWidth = 400;
	var theHeight = 340;
	var y = (screen.height - theHeight) / 2;
	var x = (screen.width - theWidth) / 2;
	var URL = "/manual_screen_viewer.cfm?image_number=" + image_number + "&total_images=" + total_images + "&article_id=" + article_id +"&path=" + path;
 
	var details = 'height='+theHeight+',width='+theWidth+',menubar=no,scrollbars=no,status=no,toolbar=no,location=no,favorites=no,left=' + x + ',screenx=' + x + ',top=' + y + ',screeny=' + y + ',resizable=no';

	popWindow = window.open( URL, "popWindow", details );
}

function popFull(URL,width,height) {

	var x = (screen.width - width) - 10; 	

   var details = 'height='+height+',width='+width+',menubar=yes,scrollbars=yes,status=yes,toolbar=yes,location=yes,favorites=yes,left=' + x + ',screenx=' + x + ',top=0,screeny=0,resizable=yes';
   
   popWindow = window.open( URL, "popFull", details );
}

function directfeed( theSite, theWidth, theHeight, theScroll ) {

	var x = screen.width - theWidth - 10;
	var details = 'height=' + theHeight + ',width=' + theWidth + ',menubar=no,scrollbars=' + theScroll + ', status=no,toolbar=no,left=' + x + ',screenx=' + x + ',top=0,screeny=0,resizable=no';
	microWindow = window.open( theSite, "microWindow", details );

}

function quickPoll (URL) {
	var theWidth = "500";
	var theHeight = "280";	
	var x = (screen.width - theWidth) / 2;
	var y = (screen.height - theHeight) / 2;
	
	var details = 'height=' + theHeight + ',width=' + theWidth + ',menubar=no,scrollbars=no, status=no,toolbar=no,left=' + x + ',screenx=' + x + ',top=' + y + ',screeny=' + y + ',resizable=no';
	microWindow = window.open( URL, "quickpollWindow", details );
}

//////////////////////////////

// EMAIL A FRIEND          //

////////////////////////////

function emailAFriend( title, path, id ) {

// sender variable this will need to change once login is set up

   var sender = new String( 'emailafriend@gamepro.com' );

   var friend = "";

   if ( sender == "" || sender.length < 4 ) sender = prompt( "Email a Friend:\nPlease enter YOUR email address ( this will be included in the email ):", "" );

   if ( sender == "" || sender == null ) return;

   if ( sender.indexOf( "@" ) == -1 || sender.indexOf( "." ) == -1 || sender.indexOf( " " ) != -1 ) {

     alert( "Email a Friend:\nThat is not a valid email address." );

	 emailAFriend( title, path );

   }

   var friend = prompt( "Email a Friend:\nPlease enter your FRIEND's email address. This will be who the email is sent to.", "" );

   if ( friend == "" || friend == null ) return;

   if ( friend.indexOf( "@" ) == -1 || friend.indexOf( "." ) == -1 || friend.indexOf( " " ) != -1 ) {

     alert( "Email a Friend:\nThat is not a valid email address." );

	 emailAFriend( title, path );

   }

   self.location = "/hub/email/send.cfm?title=" + title + "&path=" + path + "&sender=" + sender + "&friend=" + friend + "&id=" + id;

}

//////////////////////////////

// PRINT THIS ARTICLE      //

////////////////////////////

function printArticle() {
	
	var x = (screen.width - 700) -15;

   var details = 'height=500,width=700,menubar=yes,status=no,toolbar=no,left='+x+',screenx='+x+',top=0,screeny=0,resizable=yes,scrollbars=yes';

   var printWindow = window.open( "", "printWindow", details );

   printWindow.document.open();

   printWindow.document.writeln( "<title>PRINTABLE PAGE: GamePro.com / " );

   printWindow.document.writeln( self.document.printForm.genus.value );

   printWindow.document.writeln( "/");

   printWindow.document.writeln( self.document.printForm.type.value );

   printWindow.document.writeln( "/");

   printWindow.document.writeln( self.document.printForm.title.value ); 

   printWindow.document.writeln( "</title>" );

   printWindow.document.writeln( "<body bgcolor=#ffffff text=#000000 style='font-family: Trebuchet MS, Arial, Helvetica, sans-serif;'><b>" );

   printWindow.document.writeln( self.document.printForm.title.value );

   printWindow.document.writeln( self.document.printForm.genus.value );

   printWindow.document.writeln( self.document.printForm.type.value );

   printWindow.document.writeln( "from GamePro.com</b><p>" ); 

   printWindow.document.writeln( self.document.printForm.body.value );

   printWindow.document.writeln( "</body>" );

   printWindow.document.close();

   printWindow.print();

   return;   

}

//////////////////////////////

// AD CALL REFRESH         //

////////////////////////////

var today = new Date();
var timeStamp = today.getTime();
var dartSite = "home";
var dartZone = "index";

function adCall( family, genus, species, type ) {

  var section = "";

  if ( type == "news" || type == "cheats" || type == "downloads" )

  section = type;
	
  else if (type == "strategies" || type == "features")

  section = "stratfeatures";  

  else if ( family == "computer" || family == "microsoft" )

  section = genus;

  else section = family;

  if ( navigator.appName.indexOf( "Netscape" ) != -1 ) { 

      document.AD_LAYER.src = "http://ad.doubleclick.net/adl/idg.us.gamepro." + section + "/;pos=top;sz=728x90;tile=1;ord=" + timeStamp + "?"; 

	  document.IDG1_LAYER.src = "http://ad.doubleclick.net/adl/idg.pixel.global/idgpixel7.18.00;sz=1x1;ord=" + timeStamp;

      document.IDG2_LAYER.src = "http://ad.doubleclick.net/adl/idg.pixel.usa.gamepro/gamepro11.13.00;sz=1x1;ord=" + timeStamp;

  }

  else { 

      TOP_BANNER.location.replace( "http://ad.doubleclick.net/adi/idg.us.gamepro." + section + "/;pos=top;sz=728x90;tile=1;ord=" + timeStamp + "?" ); 

	  IDG1.location.replace( "http://ad.doubleclick.net/adi/idg.pixel.global/idgpixel7.18.00;sz=1x1;ord=" + timeStamp );

      IDG2.location.replace( "http://ad.doubleclick.net/adi/idg.pixel.usa.gamepro/gamepro11.13.00;sz=1x1;ord=" + timeStamp );

  }

  return;

}

function adCall2 ( section, zone ) {
	dartSite = section;
	dartZone = zone;
}

