registerCommands('alpine');
if (typeof ol_alpine=='undefined') var ol_alpine=0;
var o3_alpine=0, o3_acap;

function setAlpineVariables() {
	o3_alpine=ol_alpine;
}
function parseAlpineExtras(pf,i,ar) {
	var k=i;
	if (k < ar.length) {
		if (ar[k]==ALPINE) { eval(pf +'alpine=('+pf+'alpine==0) ? 1 : 0'); return k; }
	}
	return -1;
}

function settingsForAlpine() {
	if(o3_alpine) {
		o3_width=230;
		ol_offsetx=-10;
		ol_offsety=0;
		o3_bgcolor=o3_fgcolor='';
		o3_border=0;
		o3_hauto=1;
		o3_vpos='ABOVE';
		ol_textsize='10px';
	  ol_captionsize='11px';
	  o3_textcolor='#3d8dc7';
		if(o3_fgbackground||o3_bgbackground) o3_fgbackground=o3_bgbackground='';
		o3_sticky=0;
		if(o3_fullhtml) o3_fullhtml=0;
		if(o3_fixx>0||o3_fixy>0) o3_fixx=o3_fixy=-1;
		if(o3_relx||o3_rely) o3_relx=o3_rely=null;
		if(typeof o3_shadow!='undefined'&&o3_shadow) o3_shadow=0;
		if(o3_hpos=='CENTER'||o3_hpos=='LEFT') o3_hpos='RIGHT';
		if(o3_vauto) o3_vauto=1;
		if(o3_wrap) o3_wrap=0;
    o3_captionfontclass='TipCap';
    o3_textfontclass='TipText';
    o3_closefontclass='TipClose';
    o3_closeclick=1;
    o3_close="X";
    o3_cap+='<br/>';

	}
	return true;
}

function generateAlpine(content) {
	if(!o3_alpine) return;
	var txt='', wd,ht;
	wd = 308;
  ht=(olNs4) ? over.clip.height : over.offsetHeight;
  //<img src="'+ol_alpine_images+'/contentBG_left.png" width="'+wd+'" id="overLibContentImage"/>
	txt+= '<table cellpadding="0" cellspacing="0" border="0" width="'+wd+'">'+
			'<tr><td valign="bottom"><img src="'+ol_alpine_images+'/headerBG_left.png" height="10" width="'+wd+'"'+(olNs6 ? ' style="display: block;"' : '')+' id="overLibHeaderImage"/></td></tr>'+
			'<tr><td id="overLibContentImage"><div id="overLibContentWrap" style="position:relative; left:45px; z-index:2000;">'+content+'</div></td></tr>'+
			'<tr><td valign="top"><img src="'+ol_alpine_images+'/footerBG_left.png" height="48" width="'+wd+'" id="overLibFooterImage"/></td></tr></table>';
	layerWrite(txt);
}

registerRunTimeFunction(setAlpineVariables);
registerCmdLineFunction(parseAlpineExtras);
registerPostParseFunction(settingsForAlpine);
registerHook("olCreatePopup",generateAlpine,FAFTER);