/*
for random beliefnet functions
can't use normal js because beliefnet pages use base url of beliefnet.com
*/

function open_window(url){
		if(screen){
			var left=screen.width-475;
		}else var left=0;
		var enlarged_daily=window.open(url, 'Large_Card_of_the_Day', 'resizable=1,scrollbars=1,top=0,left='+left+',height=400,width=450');
		enlarged_daily.focus();
	}


function newSmWindow( file, w, h, t, l, winName ){
  if( !t ) var t = 10;
  if( !l ) var l = 10;
  if( !w ) var w = 350;
  if( !h ) var h = 300;
  if( !winName ) var winName = "newWindow";
  
  newWin = window.open( file, winName, 'scrollbars=1,resizable=1,top='+ t +',left='+ l +',height='+ h +',width='+ w);
  newWin.focus();
  if (newWin.opener == null) newWin.opener = self;
}

function cardOday(tarotUrl){
		var winurl = tarotUrl + "/show_daily_card.php";
		open_window(winurl);
	}
  
  /* tarot - how to frame a valid question copied from tarot.js */
  function questionInfo( tarotUrl, qKey, large ){
		var file = tarotUrl + "/tarot/features.php?file=";
		if(qKey == "valid")
			file += "question&long=1";
		else if(qKey == "sample")
			file += "sample&long=1";
                else if(qKey == "kcs")
                    file += "kcs";
                else if(qKey == "cosmic_vault")
                    file += "cosmic_vault";
                
		if(large)
			file += "&large=1";

		newSmWindow( file, 450, 380, 0, 0, 'MoreInfo' );
	}
  
  /* for iching, the reading form */
  function ichingForm(readingType, formName)
  {
    document.forms[formName].type.value = readingType;
    document.forms[formName].submit();
  }
  
  /* fake foreach funciton */
  function ForEach(array, fn)
  {
    for (var n = 0; n < array.length; n++)
      fn(array[n]);
  }

