/*
	new_window.js
	file for ftn that opens up new windows...help & contact_info & others use this
*/
	var newWin; //declare it out here so it's a global...

	function newWindow( file, w, h, t, l, winName, rsize, scrollb ){
		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";
		if( !rsize ) var rsize = "yes";
		if( !scrollb ) var scrollb = "yes";

		newWin = window.open( file, winName, 'scrollbars='+ scrollb +',resizable='+ rsize +',top='+ t +',left='+ l +',height='+ h +',width='+ w);
		newWin.focus();
		if (newWin.opener == null) newWin.opener = self;
	}

	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 tourWin( partnerId ) {
		var file = "/member_benefits/MemberTour.php";
		if( partnerId )
			file += "?code=" + partnerId;
			
		newWindow( file, 485, 353, 0, 0, 'MemberBenefitsTour', 'no', 'no' );
	}

	function refer_friend( site, ruri ){
		var newLoc = "/referral/index.php?";
	
		// user wants to refer this site to a friend
		//newLoc += "?referrer_email=" + formName.referrer_email.value + "&friend_email=" + formName.friend_email.value + "&usite=" + formName.site.value + "&page=" + formName.page.value + "&qs=" + formName.qs.value;
		if( site )	newLoc += "usite=" + site + "&";
		if( ruri )	newLoc += "ruri=" + ruri + "&";
		// open a new window with the correct parameters
		referWin( newLoc );
	}

	function referWin( newLoc ){
		if( !newLoc )
			var newLoc = "/referral";

	         if(screen){
	                var left = (screen.width/2) - 210;
	         } else var left=0;

		newWindow( newLoc, 425, 400, 10, left, 'FriendReferral', 'yes', 'yes' );
	}
	
	function get_cookie(Name) {
  		var search = Name + "="
  		var returnvalue = "";
  		if (document.cookie.length > 0) {
    			offset = document.cookie.indexOf(search)
    			if (offset != -1) { // if cookie exists
      			offset += search.length
      			// set index of beginning of value
      			end = document.cookie.indexOf(";", offset);
      			// set index of end of cookie value
      			if (end == -1)
      		 	  	end = document.cookie.length;
     		 			returnvalue=unescape(document.cookie.substring(offset, end))
      		}
   		}
  	return returnvalue;
	}

	function storeAdWin( partnerId ) {
		var file = "/store/popup-ad.php?code=" + partnerId;

		if (get_cookie('file')==''){
			newWindow( file, 250, 250, 0, 0, 'TarotStore', 'no', 'no' );
			document.cookie="file=yes"
		}
	}

	function upsellAdWin( spreadNo ) {
		var file = "/tarot/popup.php?spreadNo=" + spreadNo;
		newWindow( file, 475, 235, 0, 0, 'ExpertReading', 'no', 'no' );
	}
	
	function close_upsellAdWin(){
		if (newWin && !newWin.closed){
			newWin.close();
		}
	}
	
	function aolChat() {
		var file = "http://www.tarot.com/advisors/popup";
		newWindow( file, 500, 450, 0, 0, 'AOLChat', 'no', 'no' );
	}

	function show_card( card_id, folder ) {
		var file = "/egreetings/gc_meaning.php?picked_card=" + card_id + "&deck=" + folder;
		newWindow( file, 500, 400, 0, 0, 'CardMeaning', 'yes', 'yes' );
	}
	
	// added for numerology section 01-18-02
	function tip( section ) {
		var file = "/numerology/tip.php#" + section;
		newWindow( file, 300, 300, 0, 0, 'NumerologyTips', 'yes', 'yes' );
	}

	function sample( type ) {
		var file = "/numerology/images/samples/" + type + "1.gif";
		newWindow( file, 500, 400, 0, 0, 'ScreenShot', 'yes', 'yes' );
	}

	function headerformgo( selectopt ) {
		var loc = selectopt.options[ selectopt.selectedIndex ].value;
		if( loc != '' ) {
			window.location = loc;
		}
	}

	function popUpWindow(URL, t, s, l, st, mb, rs, w, h, name) {
    outWin = window.open(URL, name , 'toolbar=' +t +',scrollbars=' + s+ ',location=' + l +',statusbar=' + st +',menubar='+mb+',resizable='+rs+',width='+w+',height='+h);
    outWin.focus();
    if (outWin.opener == null) outWin.opener = self;
	}

	function dailyhoro( sign, partner ){
		if( partner == "marsvenus" ){
			var file = "/astrology/daily/marsvenus.php?sign=" + sign;
			var ht = 450;
			var wd = 460;
		}else{
			var file = "/astrology/daily/popup.php?sign=" + sign;
			var ht = 375;
			var wd = 450;
		}

		newWindow( file, wd, ht, 0, 0, 'DailyHoroscope', 'yes', 'yes' );
	}


function skyvibe(sign)
{
  var file = "/go2/site/sky-vibe"; //"/astrology/skyvibe/index.php";
  if (sign)
  file += "/?video=" + sign;
  newWindow( file, 780, 490, 0, 0, 'Skyvibe', 'no', 'no' );
}
