var newwindow;
var width;
var height;
function poptastic(url,width,height,winname,options)
{
	if (width==undefined || width==0) 		width=450;
	if (height==undefined || height==0) 	height=500;
	if (options==undefined)					options = 'width='+width+',height='+height+',scrollbars=yes,resizable=yes';
	if (winname==undefined)					winname='_blank';
	
	newwindow = window.open(url,winname,options);
	if (newwindow==undefined)
		window.open(url,winname,options);
	else
		if (window.focus) {newwindow.focus()}
}

function popupform(myform,windowname,width,height)
{
	if (width==undefined) width=500;
	if (height==undefined) height=300;
	if (! window.focus)return true;
	window.open('', windowname, 'width='+width+',height='+height+',scrollbars=yes,resizable=yes');
	myform.target=windowname;
	return true;
}

var popWin;
// Temporary variables to hold mouse x-y pos.s
var tempX = 0;
var tempY = 0;
// Detect if the browser is IE or not.
// If it is not IE, we assume that the browser is NS.
var IE = document.all?true:false;
// If NS -- that is, !IE -- then set up for mouse capture
if (!IE) document.captureEvents(Event.MOUSEMOVE);
// Set-up to use getMouseXY function onMouseMove
document.onmousemove = getMouseXY;

function popupwin(windowname,txtid,title,onpos,width,height)
{
	if (title=="") title = "<title>TwoNav, the dual GPS navigator</title>";
	if (width==undefined) width=360;
	if (height==undefined) height=200;
	attr = 'width='+width+',height='+height+',scrollbars=auto,resizable=no';
	if (onpos==1) {
		attr += ',left=' + (tempX+220) + ',top=' + tempY;
	}
	if (!window.focus) return true;
	content = document.getElementById(txtid).innerHTML;
	popWin = open(''+self.location, windowname, attr);
	//popWin = open(''+self.location, windowname, attr);
	popWin.document.write('<head><title>' + title + '</title></head>');
	popWin.document.write('<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />');
	popWin.document.write('<link rel="stylesheet" href="css/estilosPantalla.css" type="text/css" media="screen" />');
	popWin.document.write('<body>');
	popWin.document.write('<div id="contenido"><div class="pastillaGris50 popwin">');
	popWin.document.write(content);
  	popWin.document.write('</div></div></body></html>');
	return true;
}


// Main function to retrieve mouse x-y pos.s
function getMouseXY(e) {
	IE = document.all?true:false;
	if (IE) { // grab the x-y pos.s if browser is IE
		if (document.body==null) {
			tempX = 0
			tempY = 0
			return true
		}
		tempX = event.clientX + document.body.scrollLeft;
		tempY = event.clientY + document.body.scrollTop;
	} else {  // grab the x-y pos.s if browser is NS
		tempX = e.pageX;
		tempY = e.pageY;
	}  
	// catch possible negative values in NS4
	if (tempX < 0){tempX = 0}
	if (tempY < 0){tempY = 0}  
	// show the position values in the form named Show
	// in the text fields named MouseX and MouseY
	return true;
}

function HideMessengerCartDiv(){
	my_div=document.getElementById('cart_messenger');
	my_div.innerHTML="";
	my_div.style.display='none';
	
	return false;
}

function hide_loading(){
	var da = document.getElementById('loading_messenger');
	da.style.display="none";
	return true;	
}

function show_loading(timer) {
	var da = document.getElementById('loading_messenger');
	if (timer==undefined)
		timer = false;
	if (timer)
		setTimeout("hide_loading();", 6000);
	if (da!=undefined)
		da.style.display="block";	
	return true;
}


var browser=navigator.appName;
var b_version=navigator.appVersion;
var version=parseFloat(b_version);
if (typeof DD_roundies!="undefined")
	if (browser=="Miscrosoft Internet Explorer" && b_version.indexOf("MSIE 8.0")==-1)
		DD_roundies.addRule('.fg-button', '10px');

if (typeof jQuery != "undefined") {
	//jquery buttons
	$(function(){
		//all hover and click logic for buttons
		$(".fg-button:not(.ui-state-disabled)")
		.hover(
			function(){ 
				$(this).addClass("ui-state-hover"); 
			},
			function(){ 
				$(this).removeClass("ui-state-hover"); 
			}
		)
		.mousedown(function(){
				$(this).parents('.fg-buttonset-single:first').find(".fg-button.ui-state-active").removeClass("ui-state-active");
				if( $(this).is('.ui-state-active.fg-button-toggleable, .fg-buttonset-multi .ui-state-active') ){ $(this).removeClass("ui-state-active"); }
				else { $(this).addClass("ui-state-active"); }	
		})
		.mouseup(function(){
			if(! $(this).is('.fg-button-toggleable, .fg-buttonset-single .fg-button,  .fg-buttonset-multi .fg-button') ){
				$(this).removeClass("ui-state-active");
			}
		});
		
		$(".fg-button").css('padding','5px');
		$(".fg-button").mouseover().css('color','#555555');
		$(".fg-button").mouseover().css('text-decoration','none');
		$(".fg-button").mouseover().css('outline','none');
		
	});
}

var addthis_config = { 
	username: "compegps",
	data_track_clickback: true,
	ui_click: false
}