/*
	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 = 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 goToPage(form_name, pagename){
		document[form_name].action = pagename;
		document[form_name].submit();
	}	

	function goPosition(num, objForm, formAction, type ){
		objForm.position.value = num;
		if( formAction )	objForm.action = formAction;
		if( type )	objForm.reading_type.value = type;
		objForm.submit();
	}

	function howToPrint( readingId ){
		var filename = "/oracle/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() ){
				window.location = "/oracle/reply.php?reading_ID=" + readingId + "&delete=yes&confirm=yes";
		    }
			//refresh the page
		}
	}
	
	function confirm_delete(){
		var message = "You have chosen to delete your Expert reading. This action cannot be undone.  Do you wish to continue?";
		if(confirm(message)){
			return true;
		}
		else{
			return false;
		}
	}

	function moreInfo( filename ){
		var file = "/oracle/features.php?file=" + filename;
		newSmWindow( file, 420, 360, 0, 0, 'NameReading' );
	}
	function jumpToReading(style) {
		switch (style) {
			case 'General' :
				location.href='/oracle/iching-reading/basic.php';
				break;
			case 'Love' :
				location.href='/oracle/iching-reading/love/';
				break;
			default :
				// don't do anything
				break;
		} 
	}
