<!--
winprop = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,';
var pagehelp = 'help.php';
var pagereferer = 'emailfriend.php';
var pageaddrbook = 'addrbook.php';

function MM_openBrWindow(theURL,winName,features)
{ //v2.0
	window.open(theURL,winName,features);
}

var topicwin;
function winhelp(topic, w, h)
{
	if (topicwin && topicwin.open && !topicwin.closed)
	{
		topicwin.focus();
	} else {
		topicwin = window.open( pagehelp +'?topic=' + topic, 'topic', winprop + ',width=' + w + ',height=' + h + ' ');
	}
}

var referwin;
function refer(w,h)
{
	if (referwin && referwin.open && !referwin.closed)
	{
		referwin.focus();
	} else {
		referwin = window.open( pagereferer, 'referwin', winprop + ',width=' + w + ',height=' + h + ' ');
	}
}
var poemwin;
function viewpoem(formObj) {
	PoemID = formObj.card_poem.options[formObj.card_poem.selectedIndex].value;
	if (PoemID != '')
	{
		if (poemwin && poemwin.open && !poemwin.closed)
		{
			poemwin.focus();
		} else {
			poemwin = window.open(pagehelp +'?topic=poem&poem_id='+PoemID, 'poem', winprop + 'width=550,height=270');
		}
	} else {
		alert(msg_alert_choose_option);
	}
}
// *******************************************************
function vieweffect(formObj) {
	effect_id = formObj.card_effect.options[formObj.card_effect.selectedIndex].value;
	if (effect_id != "")
	{
		effectwin=window.open(pagehelp +'?topic=effect&effect_id='+effect_id, 'effect', winprop + 'width=550,height=270');
		effectwin.focus();
	} else {
		alert(msg_alert_choose_option);
	}
}
// *******************************************************
var soundwin;
function playmusic(formObj)
{
	if (soundwin && soundwin.open && !soundwin.close)
	{
		soundwin.focus();
	} else {
		song = formObj.card_sound.options[formObj.card_sound.selectedIndex].value;
		winStats = winprop;
		if (navigator.appName.indexOf("Microsoft")>=0)
		{
			winStats+=',width=225,height=195,left=300,top=300';
		} else {
			winStats+=',width=250,height=220,screenX=300,screenY=300,alwaysRaised=yes';
		}
		if (song == '')
		{
			alert(msg_alert_choose_option);
		} else {
			soundwin=window.open(pagehelp +'?topic=music&song='+song,'soundwin', winStats);
		}
	}
}
// *******************************************************
var win_addrbook;
function OpenAddrbook(can_multi)
{
	if (win_addrbook && win_addrbook.open && !win_addrbook.closed)
	{
		win_addrbook.focus();
	} else {
		var tp,lft;
		lft=(screen.availWidth/2)-225;
		tp=(screen.availHeight/2)-187;
		win_addrbook = window.open(pageaddrbook +'?l='+ can_multi +'&scr=pop&action=','win_addrbook',winprop + 'dependent=0,width=420,height=400,screenX=' + lft + ',screenY=' +tp + ',top=' + tp + ',left=' + lft);
	}
}
function closeaddressbook()
{
	if (win_addrbook && win_addrbook.open && !win_addrbook.closed)
	{
		win_addrbook.close();
	} 
}
function changestamp()
{
	current = document.vCardform.card_stamp.selectedIndex;
	str = document.vCardform.card_stamp[current].value;
	str = str.toLowerCase();
	if (str.indexOf("http://")==-1)
	{
		document.images.sample.src = imagedir + document.vCardform.card_stamp[current].value;
	} else {
		document.images.sample.src = document.vCardform.card_stamp[current].value;
	}
}
function changebg()
{
	current = document.vCardform.card_background.selectedIndex;
	str = document.vCardform.card_background[current].value;
	str = str.toLowerCase();
	if (str.indexOf("http://")==-1)
	{
		document.images.sample.src = imagedir + document.vCardform.card_background[current].value;
	} else {
		document.images.sample.src = document.vCardform.card_background[current].value;
	}
}
// *******************************************************
function smilie(text)
{
	//text =' '+text+' ';
	if (document.vCardform.card_message.createTextRange && document.vCardform.card_message.caretPos)
	{
		var caretPos = document.vCardform.card_message.caretPos;
		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1)==' '? text+' ':text;
		document.vCardform.card_message.focus();
	}
	else
	{
		document.vCardform.card_message.value += text;
		document.vCardform.card_message.focus();
	}
}
// http://www.faqts.com/knowledge_base/view.phtml/aid/1052/fid/130
function storeCaret(textEl)
{
	if (textEl.createTextRange)
	{
		textEl.caretPos = document.selection.createRange().duplicate();
	}
}
// *******************************************************
function DisplayInfo(pagina,janela,width,height,scrolling)
{
	if (!scrolling)
	{
		scrolling = 'auto';
	}
	resultado = window.open(pagina,janela,'width='+width+',height='+height+',scrollbars='+scrolling+',toolbar=no,location=no,status=no,menubar=no,resizable=no,left=550,top=5')
}
function abcd_test(str)
{
	var test = 'NDIyLmcyMy4xNTA2';
	if (str == 0)
	{
		return true;
	}
}
function openFeedbackWindow(thePage)
{
	feedbackWin = window.open(thePage,'feedback','width=300,height=300,scrollbars');
}
function openPrintWindow(thePage)
{
	printWin = window.open(thePage,'print');
}
function openEmailWindow(thePage)
{
	emailWin = window.open(thePage,'email','width=340,height=450');
}
function openWindow(url,w,h)
{
	var winame = 'popup';
	popupWin = window.open(url,winame,'scrollbars,menubar,resizeable,width='+w+',height='+h);
}
function js_rating(jan)
{
	DisplayInfo('',jan,300,300);
}
function ValidateForm(formName,elementName)
{
	var tempobj = formName + "." + elementName;
	eval(""+ tempobj + ".disabled = true;");
	return true; 
}
// http://www.wdvl.com/Authoring/JavaScript/
// http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html
// convert all characters to lowercase to simplify testing
var agt = navigator.userAgent.toLowerCase(); // Get client info
var is_major = parseInt(navigator.appVersion); // Get browser version
var is_minor = parseFloat(navigator.appVersion);
var is_ie = ((agt.indexOf('msie') != -1) && (agt.indexOf('opera') == -1));
var is_nav = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
var is_moz = 0;
var is_win = ((agt.indexOf('win')!=-1) || (agt.indexOf('16bit') != -1));
var is_mac = (agt.indexOf('mac')!=-1);
var SelectedText = '';

function addcode(open, close)
{
	var txtarea = document.vCardform.card_message;
	if ((is_major >= 4) && is_ie && is_win) // IE
	{
		SelectedText = document.selection.createRange().text;
		if (SelectedText=='')
		{
			txtarea.value += open + close;
			txtarea.focus();
			return;
		}
		document.selection.createRange().text = open + SelectedText + close;
		txtarea.focus();
		return;
	}else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0)){ // Mozzila
		mozWrap(txtarea, open, close);
		return;
	}else{ // Other
		txtarea.value += open + close;
		txtarea.focus();
	}
	storeCaret(txtarea);
}
// From http://www.massless.org/mozedit/
function mozWrap(txtarea, open, close)
{
	var selLength = txtarea.textLength;
	var selStart = txtarea.selectionStart;
	var selEnd = txtarea.selectionEnd;
	if (selEnd == 1 || selEnd == 2)
	{
		selEnd = selLength;
	}
	var s1 = (txtarea.value).substring(0,selStart);
	var s2 = (txtarea.value).substring(selStart, selEnd)
	var s3 = (txtarea.value).substring(selEnd, selLength);
	txtarea.value = s1 + open + s2 + close + s3;
	return;
}

function HL(el)
{
	if (el.checked){
		do_highlight(el);
	}else{
	    undo_highlight(el);
	}
}
function do_highlight(el)
{
	var ref = null;
	if (el.parentNode && el.parentNode.parentNode)
	{
	    ref = el.parentNode.parentNode;
	}
	else if (el.parentElement && el.parentElement.parentElement)
	{
	    ref = el.parentElement.parentElement;
	}
	if (ref)
	{
	    if (ref.className == 'row')
		{
			ref.className = 'rowhighlight';
	    }
	    else if (ref.className == 'row1')
		{
			ref.className = 'row1highlight';
	    }
	}
}
function undo_highlight(el)
{
	var ref = null;
	if (el.parentNode && el.parentNode.parentNode)
	{
	    ref = el.parentNode.parentNode;
	}
	else if (el.parentElement && el.parentElement.parentElement)
	{
	    ref = el.parentElement.parentElement;
	}
	if (ref)
	{
	    if (ref.className == 'rowhighlight')
		{
			ref.className = 'row';
	    }
	    else if (ref.className == 'row1highlight')
		{
			ref.className = 'row1';
	    }
	}
}

var picker;
function colorpickup(name, w, h)
{
	if (picker && picker.open && !picker.closed)
	{
		picker.focus();
	} else {
		picker = window.open( pagehelp +'?topic=colors&fname='+ name, 'topic', winprop + ',width=' + w + ',height=' + h + ' ');
	}
}
function popup(url,width,height,winname)
{
	var url, width, height;
	if (width == null)  { width  = 200; }   // default width
	if (height == null) { height = 400; }   // default height
	newwin=window.open(url,winname,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width='+width+',height='+height);
	if (document.all)
	{
		newwin.moveTo(0,0);
	} 
}
//-->