//* Write the Stylesheet that controls the Top Job Module*//

document.write(
'<style type="text/css">'+
'#title{ font-size:11px;padding-bottom:10px; font-family:Geneva,Arial,Helvetica,sans-serif; text-decoration:none;margin-left:20px; font-weight:bold; margin-right:20px}'+
'#title{ font-size:11px;font-family:Geneva,Arial,Helvetica,sans-serif; margin-left:30px; margin-right:20px;}'+
'#title a:link{color: #3366CC}'+
'#title a:visited{color: #3366CC}'+
'#title a:hover {color: #003366; text-decoration:underline;}'+
'#title a:active{color: #003366:text-dedoration:none;}'+
'#top_jobs{color:black; width:258px; border: solid 1px black; background-color:#ffffff; margin-top:20px; text-align:left;}'+
'#top_jobs a{text-decoration:none;}'+
'</style>');
//*Writes a job block in the right rain to be populated by the Top Jobs.*//
document.write(
'<div id="top_jobs">'+
'<img src="http://streaming.cnhi.zope.net/karl/Plattsburgh/_images/graphics/bullet-3366CC.gif" style="margin-left: 10px; margin-top:20px; border:none" />&nbsp;<span style="color: #030166;font-size: 10px;font-family: \'Gill Sans\', \'Gill Sans MT\', \'Verdana\', \'sans-serif\'; text-transform:uppercase;font-weight:bold;">Monster Top Jobs</span>'+
'<div id="top_jobList" style="margin-top:10px;"></div>'+
'<a href="http://www.pressrepublican.com/monster" target="_blank">'+
'<div style="text-align:center; padding:10px;"><img src="http://static.cnhi.zope.net/images/monster_logos/pressrepublican.jpg" width="240" border="0"/></div>'+
'</a>'+
'</div>');

//*Establish the variables that will be used*//
var param_idColumn = "jobid";
var param_titleColumn = "information";
var top_job="";
var job1;
var job2;
var job3;
var job4;
var job5;


//*This is the function that creates the job list based on the Google Document*//
function load_jobs_JSON(jobs_json) 
	{	
	if (jobs_json.feed.entry){var feed_length=jobs_json.feed.entry.length-1;}
		if (jobs_json.feed.entry)
		{
		switch(feed_length+1)
			{
			case 1 : job1=0; break;

			case 2 :	job1 = Math.round(feed_length*Math.random());
						do{job2 = Math.round(feed_length*Math.random());}
						while (job2 ==job1); break;

			case 3 :	job1 = Math.round(feed_length*Math.random());
						do{job2 = Math.round(feed_length*Math.random());}
						while (job2 ==job1);
						do{job3 = Math.round(feed_length*Math.random());}
						while (job1==job3 || job2 == job3);break;

			case 4 :	job1 = Math.round(feed_length*Math.random());
						do{job2 = Math.round(feed_length*Math.random());}
						while (job2 ==job1);
						do{job3 = Math.round(feed_length*Math.random());}
						while (job1==job3 || job2 == job3);
						do{job4= Math.round(feed_length*Math.random());}
						while (job1==job4 || job2 == job4 || job3 == job4);break;

			case 5 :	job1 = Math.round(feed_length*Math.random());
						do{job2 = Math.round(feed_length*Math.random());}
						while (job2 ==job1);
						do{job3 = Math.round(feed_length*Math.random());}
						while (job1==job3 || job2 == job3);
						do{job4= Math.round(feed_length*Math.random());}
						while (job1==job4 || job2 == job4 || job3 == job4);
						do{job5 = Math.round(feed_length*Math.random());}
						while (job1==job5 || job2 == job5 || job3 == job5 || job4 == job5);break;

			default:
						job1 = Math.round(feed_length*Math.random());
						do{job2 = Math.round(feed_length*Math.random());}
						while (job2 ==job1);
						do{job3 = Math.round(feed_length*Math.random());}
						while (job1==job3 || job2 == job3);
						do{job4= Math.round(feed_length*Math.random());}
						while (job1==job4 || job2 == job4 || job3 == job4);
						do{job5 = Math.round(feed_length*Math.random());}
						while (job1==job5 || job2 == job5 || job3 == job5 || job4 == job5);break;
			}

		for (var i = "0"; i < jobs_json.feed.entry.length; i++ ){
			var entry = jobs_json.feed.entry[i];
				if  (i == job1 || i == job2 || i == job3 || i == job4 || i == job5){
				if (document.title !="The Press Republican - Jobs")
				{
				top_job += '<div id="title"><a href="http://www.pressrepublican.com/monster" onClick="javascript:window.open(\'http://jobview.pressrepublican.monster.com/getjob.asp?JobID='+ entry["gsx$" + param_idColumn].$t  +'\', \'MonsterJobsWindow\', \'resizable=yes, scrollbars=1\', \'width=700px\'); " >&#149;&nbsp;'+ entry["gsx$" + param_titleColumn].$t +'</a></div>';
				} else{
				top_job += '<div id="title"><a href="javascript: void(0)" onClick="javascript:window.open(\'http://jobview.pressrepublican.monster.com/getjob.asp?JobID='+ entry["gsx$" + param_idColumn].$t  +'\', \'MonsterJobsWindow\', \'resizable=yes, scrollbars=1\', \'width=700px\'); " >&#149;&nbsp;'+ entry["gsx$" + param_titleColumn].$t +'</a></div>';
				}
				}
		}
		document.getElementById('top_jobList').innerHTML=top_job;
	}}

