/*
# Emerge Inc. - http://www.EmergeInc.com
# Copyright (C) 2010 Emerge Inc.
# V 1.0
*/
Scoreboard=window.Scoreboard||{};(function(){var VERSION='1.0';var jQuery;Scoreboard.Widget=function(s){this.init(s)};(function(){Scoreboard.Widget.prototype={init:function(s){this.layout=s.layout;this.theme=s.theme},show:function(){var self=this;if(jQuery===undefined&&(window.jQuery===undefined||window.jQuery.fn.jquery!=='1.4.2')){var script_tag=document.createElement('script');script_tag.setAttribute("type","text/javascript");script_tag.setAttribute("src","http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js");script_tag.onload=scriptLoadHandler;script_tag.onreadystatechange=function(){if(this.readyState=='complete'||this.readyState=='loaded'){scriptLoadHandler()}};(document.getElementsByTagName("head")[0]||document.documentElement).appendChild(script_tag)}else if(jQuery){main()}else{jQuery=window.jQuery;main()}function scriptLoadHandler(){jQuery=window.jQuery.noConflict(true);main()}function main(){jQuery(document).ready(function($){load_cross_domain_plugin();load_css(self.layout);$(".scoreboard-widget-holder","#scoreboard-widget-container").remove();$("#scoreboard-widget-container").prepend('<div class="scoreboard-widget-holder">Loading...</div>');load_html();$("a[name='scoreboard-widget-information']","#scoreboard-widget-container").toggle(function(){$("#scoreboard-widget-information","#scoreboard-widget-container").slideDown(500);return false},function(){$("#scoreboard-widget-information","#scoreboard-widget-container").fadeOut('slow');return false});function load_css(file){var css_link=$("<link>",{rel:"stylesheet",type:"text/css",href:"http://www.loraincounty.com/widgets/scoreboard/"+VERSION+"/"+file+".css"});css_link.appendTo('head')}function load_html(){$.ajax({url:"http://www.loraincounty.com/sports/page-parts/football_index_div.txt?"+(new Date).getTime(),type:'GET',success:function(res){res=res.responseText||res;$(".scoreboard-widget-holder","#scoreboard-widget-container").html(res);if(self.theme.alt_colors.length==2){if(self.theme.alt_colors[0]!="")$(".odd","#scoreboard-widget-container").css("backgroundColor",self.theme.alt_colors[0]);if(self.theme.alt_colors[1]!="")$(".even","#scoreboard-widget-container").css("backgroundColor",self.theme.alt_colors[1])}if(self.theme.headline.background!=""){$("#weektitle","#scoreboard-widget-container").css("color",self.theme.headline.color)}if(self.theme.header.background!=""){$(".dateinfo","#scoreboard-widget-container").css("backgroundColor",self.theme.header.background)}if(self.theme.header.color!=""){$(".dateinfo","#scoreboard-widget-container").css("color",self.theme.header.color)}if(self.theme.header.border!=""){$(".dateinfo","#scoreboard-widget-container").css("borderTopColor",self.theme.header.border)}if($("#autostatus2","#scoreboard-widget-container").html()=="On"){setTimeout(function(){load_html()},10*1000)}else{setTimeout(function(){load_html()},60*1000)}}})}function load_cross_domain_plugin(){jQuery.ajax=(function(_ajax){var protocol=location.protocol,hostname=location.hostname,exRegex=RegExp(protocol+'//'+hostname),YQL='http'+(/^https/.test(protocol)?'s':'')+'://query.yahooapis.com/v1/public/yql?callback=?',query='select * from html where url="{URL}" and xpath="*"';function isExternal(url){return!exRegex.test(url)&&/:\/\//.test(url)}return function(o){var url=o.url;if(/get/i.test(o.type)&&!/json/i.test(o.dataType)&&isExternal(url)){o.url=YQL;o.dataType='json';o.data={q:query.replace('{URL}',url+(o.data?(/\?/.test(url)?'&':'?')+jQuery.param(o.data):'')),format:'xml'};if(!o.success&&o.complete){o.success=o.complete;delete o.complete}o.success=(function(_success){return function(data){if(_success){_success.call(this,{responseText:data.results[0].replace(/<script[^>]+?\/>|<script(.|\s)*?\/script>/gi,'')},'success')}}})(o.success)}return _ajax.apply(this,arguments)}})(jQuery.ajax)}})}}}})()})();
