//jQuery.noConflict(true);
b_ajax = false;
b_frames = false;
b_pop = false;
b_dom = false;
_LOCATION = window.location.protocol+'//'+window.location.hostname+'/';
function panelPopup(url) {
	if (!arguments[1]) params = 'width=850,height=600';
	else params = arguments[1].replace('&',',');
	dim = params.match(/[0-9]+/g);
	offleft = Math.round($(window).width()/2 - dim[0]/2);
	offtop = Math.round($(window).height()/2 - dim[1]/2);
	panelPop = window.open(url, 'panelPopup', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,'+params+',left='+offleft+',top='+offtop); 
	return false;
}


//the short version of document ready
$(function(){
	var result = checkSite();
	$('a.popup').bind('click', function(e){
		result = checkSite();
        lp = $(this).attr('href').split('?');
		if (lp[0].indexOf('showPopup.php')==-1) {
			lp[0] = lp[0].replace(_LOCATION,'');
			lp[0] = 'interactive/showPopup.php/'+lp[0];
			lp[0] = _LOCATION+lp[0];
		}
		//} else if (b_dom && b_frames) {
		if (result[0] && result[2]) {
			e.preventDefault();
			tb_show('',lp.join('/3?TB_frame=true&'));
		//} else if (b_pop) {
		} else if (result[1]) {
			e.preventDefault();
			panelPopup(lp[0]+'/1',lp[1]);
		} else if(getJa() == false) {
			e.target.target = '_blank';
		}else{
		//if (b_dom && b_ajax) {			
            e.preventDefault();
			tb_show('',lp.join('/2?'));
        }
	});
	
});
var JA;
function checkSite(){
    var ajax = false;
	var pop = false;
	var frames = false;
	var obj = null;
	if (window.XMLHttpRequest) {
		b_ajax = true;
	} else if (window.ActiveXObject) {
		if ((obj = new ActiveXObject("Msxml2.XMLHTTP")) || (obj = new ActiveXObject("Microsoft.XMLHTTP"))) {
			b_ajax = true;
			obj = null;
		}
	}
	if (document.getElementById) b_dom = true;
	if (window && window.open) b_pop = true;
	if (window && window.frames) b_frames = true;
	if ($(window).width()<640) b_ajax = b_pop = b_frames = false;
	setJa(b_ajax);
	var result = [];
    result[0] = b_dom;
	result[1] = b_pop;
	result[2] = b_frames;
	result[3] = b_ajax;
    return result;	
}

function setJa(value){
    JA = value;
}

function getJa(){
    return JA;
}
/**
 *jQuery(document).ready(function($){
	var ajax = false;
	var pop = false;
	var frames = false;
	var obj = null;
	if (window.XMLHttpRequest) {
		b_ajax = true;
	} else if (window.ActiveXObject) {
		if ((obj = new ActiveXObject("Msxml2.XMLHTTP")) || (obj = new ActiveXObject("Microsoft.XMLHTTP"))) {
			b_ajax = true;
			obj = null;
		}
	}
	if (document.getElementById) b_dom = true;
	if (window && window.open) b_pop = true;
	if (window && window.frames) b_frames = true;
	if ($(window).width()<640) b_ajax = b_pop = b_frames = false;
	$('a.popup').click(function(e) {
		if (e.target.href) {
			// if user clicks text
			lp = e.target.href.split('?');
		} else if (e.target.src)  {
			// it's an image
			lp = $(e.target).parent('a').attr('href').split('?') ;
		} else {
			// it's not a text link nor an image within an ahref		
		}
		if (lp[0].indexOf('showPopup.php')==-1) {
			lp[0] = lp[0].replace(_LOCATION,'');
			lp[0] = 'interactive/showPopup.php/'+lp[0];
			lp[0] = _LOCATION+lp[0];
		}
		if (b_dom && b_ajax) {
			e.preventDefault();
			tb_show('',lp.join('/2?'));
		} else if (b_dom && b_frames) {
			e.preventDefault();
			tb_show('',lp.join('/3?TB_frame=true&'));
		} else if (b_pop) {
			e.preventDefault();
			panelPopup(lp[0]+'/1',lp[1]);
		} else {
			e.target.target = '_blank';
		}
	});




});
*
*/


