/*
function getURL(url, jQueryPopupWidth, jQueryPopupHeight){
	
	if(!url) return;
	
	var HTTP_HOST = 'http://' + window.location.hostname;
	var regExp = new RegExp(HTTP_HOST);
	if(regExp.test(url)) {
		url.replace(HTTP_HOST, '');
	}else {
		url = HTTP_HOST.concat(url);
	}
	
	var filename  = url.substr(url.lastIndexOf('/')+1, url.length);
	var extension = url.substr(url.lastIndexOf('.')+1, url.length);
	
	var match = /(avi)|(swf)|(flv)|(mpeg)/.test(extension);
	
	if(match) {
		if(extension=='mpeg' || extension=='avi') {
			movie =
				'<CENTER>'
				+ '<OBJECT ID="Video" width="305" height="250" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"'
					+ 'type="application/x-oleobject" VIEWASTEXT>'
					+ '<PARAM NAME="FileName" VALUE="'+ url +'">'
					+ '<PARAM NAME="ShowControls" VALUE="True">'
					+ '<PARAM NAME="ShowStatusBar" VALUE="True">'
					+ '<PARAM NAME="TransparentAtStart" Value="True">'
					+ '<PARAM NAME="AutoStart" Value="false">'
					+ '<PARAM NAME="AnimationatStart" Value="True">'
					+ '<PARAM NAME="autoSize" Value="false">'
					+ '<PARAM NAME="displaySize" Value="False">'
					+ '<PARAM NAME="enableContextMenu" Value="False">'
					+ '<PARAM NAME="uiMode" Value="invisible">'
					+ '<EMBED type="application/x-mplayer2"'
						+ 'pluginspage = "http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/"'
						+ 'SRC="'+ url +'" Name="MediaPlayer1" Width="305" Height="250"'
						+ 'autoStart=1 transparentAtStart=1 animationAtStart=1 autoSize=0 ShowStatusBar=1 ShowControls=1'
						+ 'displaySize=0 enableContextMenu=0 uiMode="invisible" align="center">'
					+ '</EMBED>'
				+ '</OBJECT>'
				+'</CENTER>';
		}
		else if(extension=='swf') {
			movie = 
				'<center>'
				+ '<object width="425" height="344">'
				+ '<param name="movie" value="'+ url +'"></param>'
				+ '<param name="allowFullScreen" value="true"></param>'
				+ '<param name="allowscriptaccess" value="always"></param>'
				+ '<embed src="'+ url +'" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed>'
				+ '</object>'
				+'</center>';
		}
		else if(extension=='flv') {
			movie =
				'<center>'
					+ '<div style="width:425px;height:300px;" id="player_module"></div>'
				+'</center>'
				+ '<script language="JavaScript">'
				+ 'flowplayer(' 
				+ '   "player_module",' 
				+ '   "/_script/flash/flowplayer-3.1.1.swf",' 
				+ '   "'+ url +'"' 
				+ ');'
				+ '</script>';
		}
	}
	
	var div = '<iframe src="'+ url +'" frameborder="0" width="100%" height="100%"></iframe>';
	if(match && movie) div = movie;
	$.jPopup.show('', div, jQueryPopupWidth?jQueryPopupWidth:800, jQueryPopupHeight?jQueryPopupHeight:600);
	
}
*/
var URL_BK = '';
function getURL(URL, jQueryPopupWidth, jQueryPopupHeight,endUrl){
	if(!URL) return;
	var fancy_id = arguments[4];
	var HTTP_HOST = 'http://' + window.location.hostname;
	//url
	var regExp = new RegExp(HTTP_HOST);
	if(regExp.test(URL)) {
		URL.replace(HTTP_HOST, '');
	}else {
		var regExp = new RegExp('http://');
		if(regExp.test(URL)) {
			URL = URL;
		}else {
			URL = HTTP_HOST.concat(URL);
		}
	}
	var extension = URL.substr(URL.lastIndexOf('.')+1, URL.length);
	var match = /(avi)|(swf)|(flv)|(mp4)|(mpeg)/.test(extension.toLowerCase());
	if(match) {
		videoclip = URL;
		if(extension=='mpeg' || extension=='avi') {
			movie =
				'<CENTER>'
				+ '<OBJECT ID="Video" width="305" height="250" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"'
					+ 'type="application/x-oleobject" VIEWASTEXT>'
					+ '<PARAM NAME="FileName" VALUE="'+ videoclip +'">'
					+ '<PARAM NAME="ShowControls" VALUE="True">'
					+ '<PARAM NAME="ShowStatusBar" VALUE="True">'
					+ '<PARAM NAME="TransparentAtStart" Value="True">'
					+ '<PARAM NAME="AutoStart" Value="true">'
					+ '<PARAM NAME="AnimationatStart" Value="True">'
					+ '<PARAM NAME="autoSize" Value="false">'
					+ '<PARAM NAME="displaySize" Value="False">'
					+ '<PARAM NAME="enableContextMenu" Value="False">'
					+ '<PARAM NAME="uiMode" Value="invisible">'
					+ '<EMBED type="application/x-mplayer2"'
						+ 'pluginspage = "http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/"'
						+ 'SRC="'+ videoclip +'" Name="MediaPlayer1" Width="305" Height="250"'
						+ 'autoStart=1 transparentAtStart=1 animationAtStart=1 autoSize=0 ShowStatusBar=1 ShowControls=1'
						+ 'displaySize=0 enableContextMenu=0 uiMode="invisible" align="center">'
					+ '</EMBED>'
				+ '</OBJECT>'
				+'</CENTER>';
			$(".player").fancyboxOld({
				'autoRun':true,
				'hideOnContentClick':false,
				'overlayOpacity' :.6,
				'zoomSpeedIn'    :400,
				'zoomSpeedOut'   :400,
				'easingIn'		 : 'easeOutBack',
				'easingOut'		 : 'easeInBack',
				'callbackOnShow' :function(){
					$('#fancy_div').html(movie);
					$('#fancy_close').click(function(){
						$("#fancy_div_api").remove();
					});
				},
				'callbackOnClose':function(){
					if($.trim(endUrl)!="#"&& $.trim(endUrl)!=""){
						endUrl = endUrl.substr(1, endUrl.length);
						if(!document.location.href.match('[?]')){
							var go_to =document.location.href+'?'+endUrl;
						}else{
							var go_to =document.location.href.substr(0,document.location.href.lastIndexOf('?'))+'?'+endUrl;
						}
						window.location=go_to;
					}
				}
			});
			
			$('#player').click(function(){
				$(this).fancyboxOld({
					'autoRun':true,
					'hideOnContentClick':false,
					'overlayOpacity' :.6,
					'zoomSpeedIn'    :400,
					'zoomSpeedOut'   :400,
					'easingIn'		 : 'easeOutBack',
					'easingOut'		 : 'easeInBack',
					'callbackOnShow' :function(){
						$('#fancy_div').html(movie);
						$('#fancy_close').click(function(){
							$("#fancy_div_api").remove();
						});
					},
					'callbackOnClose':function(){
						if($.trim(endUrl)!="#"&& $.trim(endUrl)!=""){
							endUrl = endUrl.substr(1, endUrl.length);
							if(!document.location.href.match('[?]')){
								var go_to =document.location.href+'?'+endUrl;
							}else{
								var go_to =document.location.href.substr(0,document.location.href.lastIndexOf('?'))+'?'+endUrl;
							}
							window.location=go_to;
						}
					}
				});
			});
		}
		else if(extension=='swf') {
			movie = 
				'<center>'
				+ '<object width="425" height="344">'
				+ '<param name="movie" value="'+ videoclip +'"></param>'
				+ '<param name="allowFullScreen" value="true"></param>'
				+ '<param name="allowscriptaccess" value="always"></param>'
				+ '<embed src="'+ videoclip +'" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed>'
				+ '</object>'
				+'</center>';
			$(".player").fancyboxOld({
				'autoRun':true,
				'hideOnContentClick':false,
				'overlayOpacity' :.6,
				'zoomSpeedIn'    :400,
				'zoomSpeedOut'   :400,
				'easingIn'		 : 'easeOutBack',
				'easingOut'		 : 'easeInBack',
				'callbackOnShow' :function(){
					$('#fancy_div').html(movie);
					$('#fancy_close').click(function(){
						$("#fancy_div_api").remove();
					});
				},
				'callbackOnClose':function(){
					if($.trim(endUrl)!="#"&& $.trim(endUrl)!=""){
						endUrl = endUrl.substr(1, endUrl.length);
						if(!document.location.href.match('[?]')){
							var go_to =document.location.href+'?'+endUrl;
						}else{
							var go_to =document.location.href.substr(0,document.location.href.lastIndexOf('?'))+'?'+endUrl;
						}
						window.location=go_to;
					}
				}
			});
			$('#player').click(function(){
				$(this).fancyboxOld({
					'autoRun':true,
					'hideOnContentClick':false,
					'overlayOpacity' :.6,
					'zoomSpeedIn'    :400,
					'zoomSpeedOut'   :400,
					'easingIn'		 : 'easeOutBack',
					'easingOut'		 : 'easeInBack',
					'callbackOnShow' :function(){
						$('#fancy_div').html(movie);
						$('#fancy_close').click(function(){
							$("#fancy_div_api").remove();
						});
					},
					'callbackOnClose':function(){
						if($.trim(endUrl)!="#"&& $.trim(endUrl)!=""){
							endUrl = endUrl.substr(1, endUrl.length);
							if(!document.location.href.match('\?')){
								var go_to =document.location.href+'?'+endUrl;
							}else{
								var go_to =document.location.href.substr(0,document.location.href.lastIndexOf('?'))+'?'+endUrl;
							}
							window.location=go_to;
						}
					}
				});
			});
		}
		else if(extension=='flv'||extension=='mp4') {
			$(".video_link").fancyboxOld({
				'autoRun':true,
				'hideOnContentClick':false,
				'overlayOpacity' :.6,
				'zoomSpeedIn'    :400,
				'zoomSpeedOut'   :400,
				'easingIn'		 : 'easeOutBack',
				'easingOut'		 : 'easeInBack',
				'callbackOnShow' :function(){
						player = $f("fancy_div",swfplayer,{
						play:{opacity:0},
						//plugins: { 
						//	 lighttpd: { 
					     //       url: "/_script/flash/flowplayer.pseudostreaming-3.1.3.swf"
					     //   } 
						//},						
						clip:{
							
							url:videoclip,
							//provider: 'lighttpd' ,
							onStart:function(clip){
								var wrap=jQuery(this.getParent());
								var clipwidth = clip.metaData.width;
								var clipheight= clip.metaData.height;
								var pos = $.fn.fancyboxOld.getViewport();
								$("#fancy_outer").css({width:clipwidth,height:clipheight});
								$("#fancy_outer").css('left', ((clipwidth + 36) > pos[0] ? pos[2] : pos[2] + Math.round((pos[0] - clipwidth	- 36)	/ 2)));
								$("#fancy_outer").css('top',  ((clipheight + 50) > pos[1] ? pos[3] : pos[3] + Math.round((pos[1] - clipheight - 50)	/ 2)));
							},
							onFinish:function(){
								$('#fancy_close').trigger('click');
								
							}
						}
					});
					player.load();
					$('#fancy_close').click(function(){
						$("#fancy_div_api").remove();
					});
				},
				'callbackOnClose':function(){
					if($.trim(endUrl)!="#"&& $.trim(endUrl)!=""){
						endUrl = endUrl.substr(1, endUrl.length);
						if(!document.location.href.match('[?]')){
							var go_to =document.location.href+'?'+endUrl;
						}else{
							var go_to =document.location.href.substr(0,document.location.href.lastIndexOf('?'))+'?'+endUrl;
						}
						window.location=go_to;
					}
				}
			});
		}
	}else {
		href = URL;
		$("a.iframe").topFancybox({
		    'hideOnContentClick': false,
		    'frameWidth': (jQueryPopupWidth?jQueryPopupWidth:800),
		    'frameHeight': (jQueryPopupHeight?jQueryPopupHeight:600),
		    'centerOnScroll': false,
		    'overlayShow': true,
		    //'overlayOpacity': .75,
		    'href': href,
		    'classiFrame': 'iframe'
		});
	}
}

(function($) {
   $.fn.topFancybox = function(settings) {
       // we would like to clone this node, but IE does not support importNode
       // instead, we will settle for creating a copy of this link in the parent document
       var a = top.document.createElement('a');
       a.style.display = 'none';
       //a.class = settings.classiFrame;
       a.setAttribute('class', settings.classiFrame);
       //a.href = settings.docURL;
       a.setAttribute('href', settings.href);
       top.document.body.appendChild(a);
       $(a).fancyboxOld(settings);
       $(a).click();
   };
})(jQuery);
function redirectPage(url,anchor){
	var form_hidden ='<form id="formHidden" action="'+url+'" method="post" style="display: none;">'+ 
					    '<input type="hidden" name="anchor" value="#'+anchor+'" />'+
					'</form>';
	$('body').append(form_hidden);
	$('#formHidden').submit();
}
/*(function($) {
   $.fn.topFancybox = function(settings) {
       // we would like to clone this node, but IE does not support importNode
       // instead, we will settle for creating a copy of this link in the parent document
       var a = top.document.createElement('a');
       a.style.display = 'none';
       a.class = this.class;
       a.href = this.href;
       top.document.body.appendChild(a);
       $(a).fancyboxOld(settings);
       $(a).click();
   };
})(jQuery);*/
