
try {
    if(typeof(toConvert) == "undefined")
	{
	    toConvert = new Array("signup", "ccbill");
	}

} catch (ex) {

  }

var $_hc_j = jQuery.noConflict();

//disable all jp links
//toConvert = new Array();

var se_sessId = parseInt(Math.random()*1234567) +""+ parseInt(Math.random()*23456);

function _se_jp_retarget()
{
    //easy for cross-domain issues
   
    tb_show('','/signup/signup.php?se=2&TB_iframe=1&modal=1&width=736&height=526','', '','','');

}

function _se_fj_t(ref)
{
    var a_rnd = Math.random()*1234567 * Math.random()*23456;

}

var hasClick = false;
function _se_fj_h()
{
    if(!hasClick)
	{
	    var a_rnd = Math.random()*1234567 * Math.random()*23456;

    $_hc_j.ajax({
	    type: "GET",
		url: "/signup/scripts/h.php?i="+se_sessId+"&a="+a_rnd
	
	});
	}
    hasClick = true;
}

$_hc_j(document).ready(function(){   
	se_tb_init('a');//pass where to apply thickbox

		imgLoader = new Image();// preload image
	imgLoader.src = tb_pathToImage;

	//	_se_fj_h();

 });

var allImgs = new Array();

//add thickbox to href & area elements that have a class of .thickbox
function se_tb_init(domChunk)
{



    var hasPrecache = true;
    
    $_hc_j(domChunk).each(function(idx, ele) 
		      {
	
			  if(this.href)
			      {
				  var toCheck = this.href.toString();
				  var myPath = this.href.toString();
				  var mA = myPath.split("/");
			          var myHost = mA[0]+"/"+mA[1]+"/"+mA[2];

				  //are we a .jpg?
				  

				   if(toCheck.toLowerCase().indexOf(".jpg") == toCheck.length-4)
							  {
							      //if we dont have an interior img src tag lets skip
							      if($_hc_j(this).children("img").length==0)
								  return;

							      //add a hover style to this
							      $_hc_j(this).children("img").addClass("sefimg");

							      var myImgHref = this.href.toString();


							      allImgs.push(toCheck);
							      $_hc_j(this).click(function(e) {
								      e.preventDefault();
								      var myTargetHref = myHost+"/signup/signup.php";
								      //

								      if((typeof(se_fj_next_tour_link) != "undefined") && se_fj_next_tour_link !='')
									  {
									      myTargetHref = se_fj_next_tour_link;
									  }
								      if((typeof(se_fj_signup_link) != "undefined") && se_fj_signup_link !='')
									  {
									      mySignupHref = se_fj_signup_link;

									  }
								      if(typeof(mySignupHref) == "undefined")
									  {
									      mySignupHref = myTargetHref;
									      myTargetHref = '';


									  }

								      tb_show('',this.href+"?TB_iframe=1", '',myTargetHref, allImgs, mySignupHref);
								      this.blur();

								      return false;
								  });
							     

						     
							  } else  if(((toCheck.toLowerCase().indexOf(".wmv") == toCheck.length-4) || (toCheck.toLowerCase().indexOf(".flv") == toCheck.length-4))) {


							  //allVids.push(toCheck)
							  var myFtHref = this.href.toString();
							  //							  this.href = '';

							  $_hc_j(this).click(function(e) {
								  e.preventDefault(); 
								  var myTargetHref = myHost + "/signup/signup.php";
								  //
								  if((typeof(se_fj_next_tour_link) != "undefined") && se_fj_next_tour_link !='')
								      {
									  myTargetHref = se_fj_next_tour_link;
								      }
								  if((typeof(se_fj_signup_link) != "undefined") && se_fj_signup_link !='')
								      {
									  mySignupHref = se_fj_signup_link;
								      }
								  if(typeof(mySignupHref) == "undefined")
								      mySignupHref="/signup/signup.php";

								  var mySessId = se_sessId;
								  //796, 567
								  
								  tb_show('',myHost+'/signup/ft_retarget.php?s='+mySessId+'&v='+escape(myFtHref)+'&TB_iframe=1&modal=1&width=736&height=526','', myTargetHref, null, mySignupHref);

								  this.blur();

								  return false;
								  
							      });

							  


						      } else {
					  var hasRewrite = false;
				      if(typeof(toConvertTypo) != "undefined")
				      {

					  for(var i in toConvertTypo)
					      {
						  if(toCheck.indexOf(i) >=0 && this.href.toString().indexOf(i)>=0)
						      {
							  this.href = toConvertTypo[i];
							  hasRewrite = true;
							  break;
						      }
					      }

				      }
				      if(!hasRewrite)
					  {
					      for(i in toConvert)
						  {
						      if(toCheck.indexOf(toConvert[i]) >=0 && this.href.toString().indexOf(toConvert[i])>=0)
							  {

							      if(this.href.toString().indexOf("fj=off") != -1)
								  continue;

							      //idk
							      if((typeof(se_fj_next_tour_link) != "undefined") && se_fj_next_tour_link !='')
								  {
								      
								      //this.href = myHost + se_fj_next_tour_link;
								  }
							      
							      
							      
							      var mySignupHrefBase = myHost+"/signup/signup.php?fj=1";
							      //							  this.href = mySignupHrefBase;
							      
							      $_hc_j(this).click(function(e) {
								      e.preventDefault();
								      var myPath = this.href.toString();
								      var myTargetHref = this.href.toString();
								      var mySignupHref = mySignupHrefBase;
								      
								      //
								      if((typeof(se_fj_next_tour_link) != "undefined") && se_fj_next_tour_link !='')
									  {
									      myTargetHref = se_fj_next_tour_link;
									      
									  }
								      if((typeof(se_fj_signup_link) != "undefined") && se_fj_signup_link !='')
									  {
									      mySignupHref = se_fj_signup_link;
									  }
								      
								      
								      //var mA = myPath.split("/");
								      //var myHost = mA[0]+"/"+mA[1]+"/"+mA[2];
								      
								      //if we only have 3 slashes or less, we should close for now
								      // var currentUrl = window.location.href;
								      // var locSlashes = currentUrl.split("/");
								      // if(locSlashes.length <= 4)
								      //    {
								      //		  myTargetHref = '';
								      //     }
								      
								      //jdj 2008-09-27 modal							  
								      
								      
								      tb_show('',mySignupHref+ '&TB_iframe=true&modal=false&height=550&width=800', '', '');
								      
								      //  window.location = mySignupHref;
								      
								      this.blur();
								      
								      
								      return false;
								  });
							  }
						  }
					  }
			      }

			      }
		      });
}




// dynamic resize for open tb's
( function( $ )  
  { 
      $.fn.wresize = function( f )  
      { 
	  version = '1.1'; 
	  wresize = {fired: false, width: 0}; 
 
	  function resizeOnce()  
	  { 
	      if ( $.browser.msie ) 
		  { 
		      if ( ! wresize.fired ) 
			  { 
			      wresize.fired = true; 
			  } 
		      else  
			  { 
			      var version = parseInt( $.browser.version, 10 ); 
			      wresize.fired = false; 
			      if ( version < 7 ) 
				  { 
				      return false; 
				  } 
			      else if ( version == 7 ) 
				  { 
				      //a vertical resize is fired once, an horizontal resize twice 
				      var width = $( window ).width(); 
				      if ( width != wresize.width ) 
					  { 
					      wresize.width = width; 
					      return false; 
					  } 
				  } 
			  } 
		  } 
 
	      return true; 
	  } 
 
	  function handleWResize( e )  
	  { 
	      if ( resizeOnce() ) 
		  { 
		      return f.apply(this, [e]); 
		  } 
	  } 
      
	  this.each( function()  
      { 
	  if ( this == window ) 
	      { 
		  $( this ).resize( handleWResize ); 
	      } 
	  else 
	      { 
		  $( this ).resize( f ); 
	      } 
      } ); 
	  return this; 
      }; 
  } ) ( jQuery );