/*
	tarot.inc (replaces reading_options.js)
	file for ftns that opens up new windows in the tarot reading section
	email, print, journal, etc.
	be sure that new_window.js has already been included...
*/


    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 =  _proxy_jslib_handle(window, 'open', '', 1, 0)( file, winName, 'scrollbars=1,resizable=1,top='+ t +',left='+ l +',height='+ h +',width='+ w);
            newWin.focus();
            if ( _proxy_jslib_handle(newWin, 'opener', '', 0, 0) == null)  _proxy_jslib_assign('', newWin, 'opener', '=', ( self));
    }
		
	function updateReport(rID) {
		var file = "/astrology/features.php?file=update&rID=" + rID;
		newSmWindow( file, 450, 380, 0, 0, 'UpdateReport' );
	}	

	function memfeatures( ) {
		var filename = "/astrology/features.php?file=memfeatures";
		newSmWindow( filename, 450, 420, 0, 0, 'MemberFeatures' );
	}
	
	function glossary( file, jumper ) {
		var filename = "/astrology/glossary.php?file="+file+"#"+jumper;
		newSmWindow( filename, 450, 420, 0, 0, 'Glossary' );
	}	

	function wheelhelp() {
		var filename = "/astrology/images/report/HowToReadChart.pdf";
		newSmWindow( filename, 640, 480, 0, 0, 'WheelHelp' );
	}	

	function faqs(section) {
		var file = "/astrology/features.php?file=faqs";
		if( section )
			file = file + "#" + section;
		newSmWindow( file, 450, 380, 0, 0, 'ChartInfo' );
	}	
	
	function authors( id ) {
		var file = "/astrology/features.php?file=authors#"+id;
		newSmWindow( file, 450, 380, 0, 0, 'ChartInfo' );
	}	

	function chartinfo( id ) {
		var file = "/astrology/features.php?file=longdesc&chart_ID="+id;
		newSmWindow( file, 450, 560, 0, 0, 'ChartInfo' );
	}	

	function howToPrint( readingId ) {
		var filename = "/astrology/features.php?reading_ID=" + readingId + "&file=print";
		newSmWindow( filename, 450, 420, 0, 0, 'PrintHelp' );
	}

	function deleter( readingId, shared, loggedIn ) {
		if( !loggedIn || shared )
			alert("This option is available only to logged in Tarot.com members with this reading saved in their journal.");
		else{
			if( confirm_delete() ){
				 _proxy_jslib_assign('', window, 'location', '=', ( "/astrology/saved.php?reading_ID=" + readingId + "&delete=yes&confirm=yes"));
		    }
			//refresh the page
		}
	}
	
	function confirm_delete() {
		var message = "Are you sure you want to delete this Report? This action cannot be undone.  Do you wish to continue?";
		if(confirm(message)){
			return true;
		}
		else{
			return false;
		}
	}
 ;
_proxy_jslib_flush_write_buffers() ;