var moAdData = new Object();
moAdData.area = "MONEY";
moAdData.site = "IWON";
moBones = 5;

function change(image,ext) {
    if (document.images && typeof(document.images[image]) != "undefined")
        document.images[image].src = eval(image + ext + ".src");
}
function findQuote() {
    var ticker = document.symbol_research.symbol.value;
    var base_url = 'http://money.iwon.com/';
       if (ticker == "") {
	    alert('Please Enter a Symbol');
	    } else {
        document.location.href = base_url + 'jsp/qt/short.jsp?symbol_search_text=' + ticker;
        }
    return false;
}
//alert("your usernum is "+ readCookie('user_num'));
var userVal= readCookie('user_num');
var isSignedIn = '';
if ((userVal == "false") || (userVal == "")) {
   isSignedIn = 'false';
} else {
   isSignedIn = 'true';
}
//alert("isSignedIn = " + isSignedIn);


function notAvail(img) {
img.src = 'http://ak.imgfarm.com/images/weather.com/Icons/Dom%20Size%2052/na.gif';
img.height='42';
img.width='50';
}
function globHtmlWriteSponLinksPop(mode){
var url='http://www1.iwon.com/Common/commonHTML/popup_generic/0,22925,sponLinks,00.html';
window.open(url,'globHtmlWriteSponLinksPopWin','width=300,height=300,location=no,menubar=no,status=no,scrollbars=no,toolbar=no,resizable=no');
}

function pcDrawPrize() {
retDrawPrize='';
	if (isWknd == '0') {
	retDrawPrize='<img src="http://ak.imgfarm.com/images/hp5/pCentral_daily2.gif" alt="" width="300" height="65" border="0">';
	} else if (isWknd == '1') {
	retDrawPrize='<img src="http://ak.imgfarm.com/images/hp5/pCentral_Weekend.gif" alt="" width="300" height="62" border="0">';
	} else {
	retDrawPrize='<img src="http://ak.imgfarm.com/images/hp5/pCentral_daily2.gif" alt="" width="300" height="65" border="0">'; 
	}
	document.write(retDrawPrize);
}	

function pcWinnersData() {
	var winDataLast ='';
	var LastName=winData[1];
	winDataLast = LastName.substring(0,1);	
	retWinnerNames='<a href="http://winners.iwon.com/winners.html">'+winData[0]+'&nbsp;'+winDataLast+'</a>, '+winData[2]+',&nbsp;'+winData[3]+' just won!<br>';
	document.write(retWinnerNames);
}

function drawPrizeCentral(){
	pcDrawPrize();
	document.write('<br>');
	pcWinnersData();
}

function doSearch() {
	var s = gE('search1').value;
}
var DOW_SYMBOL="";var DOW_LAST="";var DOW_NET_CHANGE="";var NASDAQ_SYMBOL="";var NASDAQ_LAST="";var NASDAQ_NET_CHANGE="";var SP500_SYMBOL="";var SP500_LAST="";var SP500_NET_CHANGE="";var MKT_TIME="";
function wMark(){var r='';if(DOW_LAST==""){r+='<span class=small>Current stock market results will return shortly.  We apologize for this inconvenience.</span>';}else{var space = '&nbsp;&nbsp;&nbsp;';function pad(str) { return '&nbsp;' + str + '&nbsp;'; }r+='<table cellspacing=0 cellpadding=0 border=0><tr><td class=stocks>' + pad(DOW_SYMBOL) + '</td><td class=stocks align=right>' + pad(DOW_LAST) + '</td><td class=stocks>' + pad(DOW_NET_CHANGE) + space + '</td><td class=stocks>' + pad(NASDAQ_SYMBOL) + '</td><td class=stocks align=right>' + pad(NASDAQ_LAST) + '</td><td class=stocks>' + pad(NASDAQ_NET_CHANGE) + space + '</td><td class=stocks nowrap>' + pad(SP500_SYMBOL) + '</td><td class=stocks align=right>' + pad(SP500_LAST) + '</td><td class=stocks >' + pad(SP500_NET_CHANGE)+'</td></tr></table>';}document.write(r);}
function wMarkTime(){
var r2='';
if(DOW_LAST==""){
       r2+='<span class=small>Not Avail.</span>';
} else {
 r2+='<span class=stock>'+(MKT_TIME!=''?MKT_TIME:'');
}
document.write(r2);
}

function wHPnewsOutPut(newsPosition) {
	newsRet='';
	loopStart='0';
	loopEnd='';
	//time 
	    newsRet+='<table border=0 cellpadding=0 cellspacing=0 width=100%><tr>';
									newsRet+='<td width=50% align=left>&nbsp;&nbsp;<a href="'+ nwNews[newsPosition][0][3] +'"><strong>'+ nwNews[newsPosition][0][1] +'</strong></a></td>';
                                     newsRet+='<td width=50% align=right><span class="newsTime">'+ nwNews[newsPosition][0][4] +'</span>&nbsp;&nbsp;</td>';
                                newsRet+='</tr></table>';
        //article build
		newsRet+='<table border=0 cellpadding=3 cellspacing=0 width=435>';
		      newsRet+='<tr><td width=3>&nbsp;</td><td>';
			         if ((nwNews[newsPosition][2] != "") && (nwNews[newsPosition][2] != null))  {
						//topnews output variation
							//alert("the "+nwNews[newsPosition][0][0]+" feed is this long: "+ nwNews[newsPosition][2].length);	
								if (nwNews[newsPosition][0][0] == "AT") {					  
								  if (nwNews[newsPosition][2].length <= "5") {
								    	loopEnd=nwNews[newsPosition][2].length;
									} else {
								   		loopEnd='5';
								  }					  
								  loopStart='1';
								} else { 
									if (nwNews[newsPosition][2].length <= "4") {
								    	loopEnd=nwNews[newsPosition][2].length;
									} else {
								   		loopEnd='4';
									}
								}									
								//if no output arrays - write error message
								if ((nwNews[newsPosition][2].length != "0") && (nwNews[newsPosition][2].length != null))  {
								        //main loop
										if (nwNews[newsPosition][1][0] != "") {										
											for( i=loopStart; i < loopEnd; i++ ) {
											               //alert(i);
														   //alert(nwNews[newsPosition][1][0]);
														   if ((nwNews[newsPosition][2][i][0] != "") && (nwNews[newsPosition][2][i][1])) {
														   
																   newsRet+='<img src="http://ak.imgfarm.com/images/hp5/newsDot.gif" alt="" width="3" height="4" border="0" align="absmiddle">&nbsp;'; 
																   if ((nwNews[newsPosition][0][0] == "AT") || (nwNews[newsPosition][0][0] == "AE") || (nwNews[newsPosition][0][0] == "AC")) {
																    newsRet+='<a href='+ nwNews[newsPosition][1][0] + '/' + nwNews[newsPosition][2][i][0] + '.html>'+ nwNews[newsPosition][2][i][1] +'</a><img src="http://ak.imgfarm.com/images/spacer.gif" alt="" width="1" height="17" border="0" align="absmiddle"><br>';
																   } else { 
																    newsRet+='<a href='+ nwNews[newsPosition][1][0] + nwNews[newsPosition][2][i][0] + '.html>'+ nwNews[newsPosition][2][i][1] +'</a><img src="http://ak.imgfarm.com/images/spacer.gif" alt="" width="1" height="17" border="0" align="absmiddle"><br>';
																   }	
															}														   
											}
										} else {
										  newsRet+='<em>This news area is temporarily unavailable.</em><p>';
										}	
										
								} else {
									newsRet+='<em>This news item is temporarily unavailable.</em><p>';
								}
							} else {
									newsRet+='<em>This news item is temporarily unavailable.</em><p>';
							}				
     		   newsRet+='</td>';
		       newsRet+='</tr>';
			   newsRet+='</table>';
		document.write(newsRet);
}			


function wHPnewsHeadline(newsPosition) {
newsHeadlineRet='';
newsHeadlineRet+='<table border=0 cellpadding=0 cellspacing=0 width=435>';
		      newsHeadlineRet+='<tr>';
			  newsHeadlineRet+='<td width=5>&nbsp;</td>';	
						   if (nwNews[newsPosition][2][0][4] != "") {
								     newsHeadlineRet+='<td valign=top width=110>';								   
								     newsHeadlineRet+='<a href='+nwNews[newsPosition][1][0]  + '/' + nwNews[newsPosition][2][0][0] +'.html>';
									 newsHeadlineRet+='<img src=http://ak.imgfarm.com/images/ap/gallery/'+ nwNews[newsPosition][2][0][4] +' border=0></a></td>';
							} else {
							newsHeadlineRet+='<td></td>';
							}
							newsHeadlineRet+='<td width=313 valign=top>';						 
							   newsHeadlineRet+='&nbsp;<a href='+ nwNews[newsPosition][1][0] + '/' + nwNews[newsPosition][2][0][0] + '.html>'+ nwNews[newsPosition][2][0][1] +'</a></span>&nbsp;<table border=0 cellpadding=3 cellspacing=0 width=100%><tr><td>'+ nwNews[newsPosition][2][0][2] + '</td></tr></table></td>';
		       newsHeadlineRet+='</tr>';
			   newsHeadlineRet+='</table>';
		document.write(newsHeadlineRet);
}

var month = '*'; 
var day = '+1';   
var dow = 0;     
var hour = 0;
var tz = -4;  
var lab = 'cd';

function start() {displayCountdown(setCountdown(month,day,hour,tz),lab);}
loaded(lab,start);

var pageLoaded = 0; window.onload = function() {pageLoaded = 1;}
function loaded(i,f) {if (document.getElementById && document.getElementById(i) != null) f(); else if (!pageLoaded) setTimeout('loaded(\''+i+'\','+f+')',100);
}
function setCountdown(month,day,hour,tz) {var m = month; if (month=='*') m = 0;  var c = setC(m,day,hour,tz); if (month == '*' && c < 0)  c = setC('*',day,hour,tz); return c;} function setC(month,day,hour,tz) {var toDate = new Date();if (day.substr(0,1) == '+') {var day1 = parseInt(day.substr(1));toDate.setDate(toDate.getDate()+day1);} else{toDate.setDate(day);}if (month == '*')toDate.setMonth(toDate.getMonth() + 1);else if (month > 0) { if (month <= toDate.getMonth())toDate.setYear(toDate.getYear() + 1);toDate.setMonth(month-1);}
if (dow >0) toDate.setDate(toDate.getDate()+(dow-1-toDate.getDay())%7);
toDate.setHours(hour);toDate.setMinutes(0-(tz*60));toDate.setSeconds(0);var fromDate = new Date();fromDate.setMinutes(fromDate.getMinutes() + fromDate.getTimezoneOffset());var diffDate = new Date(0);diffDate.setMilliseconds(toDate - fromDate);return Math.floor(diffDate.valueOf()/1000);}

function displayCountdown(countdn,cd) 
						{
							if (countdn < 0) document.getElementById(cd).innerHTML = '<a onMouseDown="urchinTracker(\'/clicks/iw2/prizecentral/newest_winner\');" href="http://winners.iwon.com/" class="prizeText">Are you the next winner</a>?'; else 
								{
									var secs = countdn % 60; 
									if (secs < 10) secs = '0'+secs;var countdn1 = (countdn - secs) / 60;
									var mins = countdn1 % 60; 
									if (mins < 10) mins = '0'+mins;
									countdn1 = (countdn1 - mins) / 60;
									var hours = countdn1 % 24;
									var days = (countdn1 - hours) / 24;
									document.getElementById(cd).innerHTML = 'Next Winner in '+hours+':'+mins+':'+secs;setTimeout('displayCountdown('+(countdn-1)+',\''+cd+'\');',999);
								}
						}


function randomPogo() {
	var RandNum = Math.floor(Math.random()*5)
	if (RandNum == 0) {
		document.write('<td width=33% valign=top><a href="http://casino-games.pogo.com/games/ez-win-bingo?site=pogo&sourceid=cam038_iWONCPAHomePage_EZWinBingo_FreePogo_81x46_EZWinBingoSite" onMouseDown="urchinTracker(\'/clicks/iw2/pogo/r1_bingo\');"><img src="http://ak.imgfarm.com/images/hp5/pogo/tn-bingo3.gif" alt="" width="80" height="45" border="0"><br>Bingo</a></td><td width=33% valign=top><a href="http://board-games.pogo.com/?sourceid=cam038_iWONCPAHomePage_BoardGamesSite_Backgammon_FreePogo_81x46_BoardGamesSite" onMouseDown="urchinTracker(\'/clicks/iw2/pogo/r1_backgammon\');"><img src="http://ak.imgfarm.com/images/hp5/pogo/tn-backgammon3.gif" alt="" width="80" height="45" border="0"><br>Backgammon</a></td><td width=34% valign=top><a href="http://www.pogo.com/marketing/landing/lp-flash-tour.jsp?site=pogo&sourceid=cam038_iWONCPAHomePage_Bowling_FreePogo_81x46_GeneralS" onMouseDown="urchinTracker(\'/clicks/iw2/pogo/r1_bowling\');"><img src="http://ak.imgfarm.com/images/hp5/pogo/tn-bowling3.gif" alt="" width="80" height="45" border="0"><br>Bowling</a></td>');
	} else if  (RandNum == 1) {
		document.write('<td width=33% valign=top><a href="http://www.pogo.com/marketing/landing/lp-checkers.jsp?site=pogo&sourceid=cam038_iWONCPAHomePage_Checkers_FreePogo_81x46_Checkers" onMouseDown="urchinTracker(\'/clicks/iw2/pogo/r2_checkers\');"><img src="http://ak.imgfarm.com/images/hp5/pogo/tn-checkers3.gif" alt="" width="80" height="45" border="0"><br>Checkers</a></td><td width=33% valign=top><a href="http://card-games.pogo.com/?Sourceid=cam038_iWONCPAHomePage_CardGamesSite_FirstClassSolitaire_FreePogo_81x46_CardGamesSite" onMouseDown="urchinTracker(\'/clicks/iw2/pogo/r2_fc_solitaire\');"><img src="http://ak.imgfarm.com/images/hp5/pogo/tn-fc_solitaire3.gif" alt="" width="80" height="45" border="0"><br>First Class Solitaire</a></td><td width=34% valign=top><a href="http://www.pogo.com/hotdeploy/us/promotions/marketing/landing/lp-hangman.jsp?site=pogo&sourceid=cam038_iWONCPAHomePage_Hangman_FreePogo_81x46_HangmanHijinks" onMouseDown="urchinTracker(\'/clicks/iw2/pogo/r2_hangman\');"><img src="http://ak.imgfarm.com/images/hp5/pogo/tn-hangman3.gif" alt="" width="80" height="45" border="0"><br>Hangman</a></td>');
	} else if  (RandNum == 2) {
		document.write('<td width=33% valign=top><a href="http://www.pogo.com/marketing/landing/lp-arcade.jsp?site=pogo&sourceid=cam038_iWONCPAHomePage_HighStakesPool_FreePogo_81x46_Arcade" onMouseDown="urchinTracker(\'/clicks/iw2/pogo/r3_hs_pool\');"><img src="http://ak.imgfarm.com/images/hp5/pogo/tn-hs_pool3.gif" alt="" width="80" height="45" border="0"><br>High Stakes Pool</a></td><td width=33% valign=top><a href="http://www.pogo.com/hotdeploy/us/promotions/marketing/landing/lp-freecell-mt.jsp?site=pogo&sourceid=cam038_iWONCPAHomePage_PaydayFreeCell_FreePogo_81x46_PaydayFreeCell" onMouseDown="urchinTracker(\'/clicks/iw2/pogo/r3_pd_freecell\');"><img src="http://ak.imgfarm.com/images/hp5/pogo/paydayfreecell2.gif" alt="" width="80" height="45" border="0"><br>PayDay Free Cell</a></td><td width=34% valign=top><a href="http://www.pogo.com/marketing/landing/lp-spades.jsp?site=pogo&sourceid=cam038_iWONCPAHomePage_Spades_FreePogo_81x46_Spades" onMouseDown="urchinTracker(\'/clicks/iw2/pogo/r3_spades\');"><img src="http://ak.imgfarm.com/images/hp5/pogo/tn-spades3.gif" alt="" width="80" height="45" border="0"><br>Spades</a></td>');
	} else if  (RandNum == 3) {
		document.write('<td width=33% valign=top><a href="http://puzzle-games.pogo.com/?site=pogo&sourceid=cam038_iWONCPAHomePage_Stackem_FreePogo_81x46_PuzzleSite" onMouseDown="urchinTracker(\'/clicks/iw2/pogo/r4_stackem\');"><img src="http://ak.imgfarm.com/images/hp5/pogo/tn-stackem3.gif" alt="" width="80" height="45" border="0"><br>Stack &rsquo;em</a></td><td width=33% valign=top><a href="http://www.pogo.com/hotdeploy/us/promotions/marketing/landing/lp-sudoku.jsp?site=pogo&sourceid=cam038_iWONCPAHomePage_SudokuClassic_FreePogo_81x46_SudokuClassic" onMouseDown="urchinTracker(\'/clicks/iw2/pogo/r4_sudoku_classic\');"><img src="http://ak.imgfarm.com/images/hp5/pogo/tn-sudoku_classic3.gif" alt="" width="80" height="45" border="0"><br>Sudoku Classic</a></td><td width=34% valign=top><a href="http://word-games.pogo.com/games/tumble-bees?site=pogo&sourceid=cam038_iWONCPAHomePage_TumbleBees_FreePogo_81x46_TumbleBeesSite" onMouseDown="urchinTracker(\'/clicks/iw2/pogo/r4_tumble_bees\');"><img src="http://ak.imgfarm.com/images/hp5/pogo/tn-tumble_bees3.gif" alt="" width="80" height="45" border="0"><br>Tumble Bees</a></td>');
	} else if  (RandNum == 4) {
		document.write('<td width=33% valign=top><a href="http://www.pogo.com/marketing/landing/lp-casino-pogo.jsp?site=pogo&sourceid=cam038_iWONCPAHomePage_Turbo21_FreePogo_81x46_Casino" onMouseDown="urchinTracker(\'/clicks/iw2/pogo/r5_turbo21\');"><img src="http://ak.imgfarm.com/images/hp5/pogo/tn-turbo213.gif" alt="" width="80" height="45" border="0"><br>Turbo 21</a></td><td width=33% valign=top><a href="http://casino-games.pogo.com/games/vaults-of-atlantis-slots?site=pogo&sourceid=cam038_iWONCPAHomePage_VaultsofAtlantis_FreePogo_81x46_VaultsofAtlantisSite" onMouseDown="urchinTracker(\'/clicks/iw2/pogo/r5_atlantis\');"><img src="http://ak.imgfarm.com/images/hp5/pogo/tn-atlantis3.gif" alt="" width="80" height="45" border="0"><br>Vaults of Atlantis</a></td><td width=34% valign=top><a href="http://www.pogo.com/hotdeploy/us/promotions/marketing/landing/lp-wordwhomp-mt.jsp?site=pogo&sourceid=cam038_iWONCPAHomePage_WordWhomp_FreePogo_81x46_WordWhompTips" onMouseDown="urchinTracker(\'/clicks/iw2/pogo/r5_whomp\');"><img src="http://ak.imgfarm.com/images/hp5/pogo/tn-whomp3.gif" alt="" width="80" height="45" border="0"><br>Word Whomp</a></td>');
	} 
}						