
popUpWin=0;
popUpWin2=0

function load_splash()
{
  var so = new SWFObject("/clips/clip1.swf", "sotester", "120", "80", "8", "#CCCCCC");
    so.addVariable("repeat", "true");
    so.addVariable("wmode","transparent");
    so.write("clip1");
  var so2 = new SWFObject("/clips/clip2.swf", "sotester", "120", "80", "8", "#CCCCCC");
    so2.addVariable("repeat", "true");
    so2.addVariable("wmode", "transparent");
    so2.write("clip2");
  var so3 = new SWFObject("/clips/clip3.swf", "sotester", "120", "80", "8", "#CCCCCC");
    so3.addVariable("repeat", "true");
    so3.addVariable("wmode", "transparent");
    so3.write("clip3");
}

function showCreditsWindow()
{
  window.open('/buy_credits.php','buyCredits','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizeable=yes,width=600,height=800,left=12,top=12,screenX=12,screenY=12');
  return true;
}


function popUpWindow(URLStr, left, top, width, height)
{
  if(popUpWin) {
   if(!popUpWin.closed) popUpWin.close();
  }
	  window.open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');

  return false;
}


function popUpWindow2(URLStr, left, top, width, height)
{
  if(popUpWin2) {
   if(!popUpWin2.closed) popUpWin2.close();
  }
  window.open(URLStr, 'popUpWin2', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');

  return false;
}


function popUpChat(e)
{
  popUpWindow('/chat2/index.html', 12, 12, 800, 700)
  return false;
}


function popitup(url,hh,ww)
{
  newwindow=window.open(url,'name','height='+hh+',width='+ww+',resizable=yes,scrollbars=yes');
  if (window.focus) {newwindow.focus()}
  return false;
}


function popUpChat2()
{
  popitup('/chat2/index.html', 580, 970);
}


function popUpSession()
{
  popUpWindow2('/session-online/',12,12,1048,720);
}


function loadIframe(iframeName, url)
{
  if ( window.frames[iframeName] ) {
    new_url = '/' + url
    window.frames[iframeName].location = url; 
    show_iframe();
    if (iframeName == 'signup')
    {
      show_signup();
      resize_signup();
    }
    document.getElementById(iframeName).focus();
    return false;

  }
  else return true;
}


function loadcontentdiv(link)
{
  var url = '/' + link;
  var AJAX = new Ajax.Updater(
      'content_holder', 
        url,
        {
        method: 'get', 
        parameters: ''
        });
}


function confirm_adult(redirect_after_agreed)
{
  Dialog.confirm("<br><input type='checkbox' id='terms_confirm' name='confirm' value=''>I am at least 18 years of age and I have read and agree to Rapturevision's <a href='#' onclick='show_terms()'>terms and conditions</a>.<br>", 
   {windowParameters: {width:300, height:150}, 
                       id: "terms", 
                       className: "rapture", 
                       okLabel: "Agree", 
                       cancelLabel: "Disagree", 
                       title: "Adult Confirmation", 
                       destroyOnClose: false,
  cancel:function(win) {window.location = 'http://www.google.com/';},
    ok:function(win) {
      var terms = $('terms_confirm');
      if (terms.checked == true) 
	  {
        agree_to_terms(redirect_after_agreed);

       	return true;

      } 
	  else 
	  {
        alert('You must check the checkbox in order to view RaptureVision.');  
      }
    }
  });
}


function confirm_adult2(redirect_after_agreed)
{
  Dialog.confirm("<br><input type='checkbox' id='terms_confirm' name='confirm' value=''>I am at least 18 years of age and I have read and agree to Rapturevision's <a href='#' onclick='show_terms()'>terms and conditions</a>.<br>", 
   {windowParameters: {width:300, height:150}, 
                       id: "terms", 
                       className: "rapture", 
                       okLabel: "Agree", 
                       cancelLabel: "Disagree", 
                       title: "Adult Confirmation", 
                       destroyOnClose: false,
  cancel:function(win) {window.location = 'http://www.google.com/';},
    ok:function(win) {
      var terms = $('terms_confirm');
      if (terms.checked == true) {

        agree_to_terms2(redirect_after_agreed);

        return true;
      } else {
        alert('You must check the checkbox in order to view RaptureVision.');  
      }
    }
  });
}


function show_terms()
{
  var win = new Window(
                      {className: "rapture", 
                      id: 'terms_cond',
                      title: "RaptureVision Terms and Conditions", 
                      top:70, 
                      left:100, 
                      width:500, 
                      height:400,
                      draggable: true,
                      destroyOnClose: true,
                      url: "/public/terms.php", 
                      showEffectOptions: {duration:1.5}}) 
  win.show();
}


function show_contentdiv()
{
  var cf = $('contentframe');
  var cd = $('contentdiv');
  cf.hide();
  cd.show();
}


function show_iframe()
{
  var cf = $('contentframe');
  var cd = $('contentdiv');
  var signup = $('signup');
  var loading = $('loading');
  loading.hide();
  cd.hide();
  signup.hide();
  cf.show();
}


function show_signup()
{
  var cf = $('contentframe');
  var cd = $('contentdiv');
  var signup = $('signup');
  cd.hide();
  cf.hide();
  signup.show();
}


function popUpvideo(id)
{
	{
	  var width = 480;
	  var height = 530;
	  var new_url = "/holding.php?video=" + id;
	  var new_id = 'video_player'+id;
	  if (id == 'free')
	  {
	    var width = 600;
	    var height = 600;
	    var new_url = "/holding_free.php";
	  }
	    var win = new Window(
			      {className: "rapture",
			      title: "RaptureVision Video Player",
			      id: new_id,
			      top:20,
			      left:160,
			      width: width,
			      height: height,
			      draggable: true,
			      destroyOnClose: true,
			      maximizable:false,
			      url: new_url, 
			      showEffectOptions: {duration:1.5}}) 
	  win.show();
	}
}


function popUpPic(name, id)
{
	{
		var new_url = '/domme/pic_viewer.php?picture_id=' + id + '&name=' + name;
		var new_id = 'pic_player'+id;
		var win = new Window(
			      {className: "rapture",
			      title: "RaptureVision Pic Viewer",
			      id: new_id,
			      top:20,
			      left:160,
			      width:480,
			      height:525,
			      resizable: false,
			      draggable: true,
			      destroyOnClose: true,
			      url: new_url,
			      showEffectOptions: {duration:1.5}
			      }) 
		win.show();
	  }
	  
	document.getElementById('contentframe').focus();
}


function redirect_page_after_agreed(redirect_url)
{
	if (redirect_url != '') document.location = redirect_url ;
}


function agree_to_terms(redirect_after_agreed)
{
  	var url = '/ajax/confirm.php';
  	var AJAX = new Ajax.Request(
  	url,
   	{
   	method: 'post',
   	parameters: 'action=agree',
	asynchronous: false
   	});

	redirect_page_after_agreed(redirect_after_agreed) ;

  	load_splash();
}


function agree_to_terms2(redirect_after_agreed)
{
	var x = 0 ;
	var url = '/public/ajax/confirm.php';
	var AJAX = new Ajax.Request(
  	url,
	{
	method: 'post',
	parameters: 'action=agree',
	asynchronous: false
   	});

	redirect_page_after_agreed(redirect_after_agreed) ;
}


function good_menu()
{
  var realmenu = $('realmenu');
  var tempmenu = $('tempmenu');
  if (tempmenu != null)
  {
  tempmenu.hide();
  }
  if (realmenu != null)
  {
    realmenu.show();
  }
}
