
/*** fixing target url code ***/


var myRegExp = new Array();

myRegExp[0] = /http:\/\/www./;
myRegExp[1] = /http:\/\//;
myRegExp[2] = /www./;

var string1 = document.location.href;
var repz = '';
for( a = 0 ; a <=2; a++ ){

	
	var matchPos1 = string1.search(myRegExp[a]);
	
	if(matchPos1 != -1){
		
				
		if(a == 0){
			var repz = 'http://www.';	
		}
		

		if(a == 1){
			var repz = 'http://';	
		}

		if(a == 2){
			var repz = 'www.';	
		}

		
	}
}


var string1 = target_url;

var matchPos1 = string1.search(myRegExp[0]);
	
	if(matchPos1 != -1){
		string1 = string1.replace(myRegExp[0], '');
	}
	
var matchPos2 = string1.search(myRegExp[1]);	
	if(matchPos2 != -1){
		string1 = string1.replace(myRegExp[1],'');
	}
	
var matchPos3 = string1.search(myRegExp[2]);	
	if(matchPos3 != -1){
		string1 = string1.replace(myRegExp[2],'');
	}
		
		
string1 = repz+string1;



target_url = string1; 


/*** end fixing target url code ***/








function calcHeight()
 {

var the_height=document.getElementById('resize').contentWindow.document.body.scrollHeight;

the_height = the_height + 50;

document.getElementById('resize').height=the_height;
}





var tried_exit = false;

$(document).ready ( function () {

var embed = '<object style="height: 0px; width: 0px;" type="application/x-shockwave-flash" data="exit-catcher-files/player_mp3.swf" width="1" height="1"><param name="movie" value="exit-catcher-files/player_mp3.swf" /><param name="FlashVars" value="mp3=' + audio_file + '&autoplay=1" /></object>';		

var frame ='<iframe src="' + target_url + '" onLoad="calcHeight();" scrolling="no" align="middle" frameborder="0" width="100%" name="resize" id="resize"></iframe>';

					
window.onbeforeunload = exiting;

function exiting () {

	tried_exit = true;

	$('body').html('');

	play();

	$('body').prepend( frame );

	return exit_msg;

}

function play() {

		$('body').prepend( embed );

}



} );
