
subimgover=new Image;
subimgout=new Image;
subimgover.src="/img/submenu_bullet_on.gif";
subimgout.src="/img/submenu_bullet.gif";

function subImgOn(i) {
  if(document.images) document.images["submenu" + i].src=subimgover.src;
}

function subImgOff(i) {
subimgout.src="/img/submenu_bullet"+i+".gif";
  if(document.images) document.images["submenu" + i].src=subimgout.src;
}
		
topimgover=new Image;
topimgout=new Image;
topimgover.src="/img/topmenu_bullet_on.gif";
topimgout.src="/img/topmenu_bullet.gif";

function topImgOn(i) {
  if(document.images) document.images["topmenu" + i].src=topimgover.src;
}

function topImgOff(i) {
  if(document.images) document.images["topmenu" + i].src=topimgout.src;
}


function PopupPage(doc, w, h) {
  if (!w) w=650; 
  if (!h) h=500; 
  win = window.open(doc, "Monitor", 'status=no,toolbar=0,scrollbars=1,menubar=0,titlebar=0,resizable=0,width='+w+',height='+h);
  win.moveTo(screen.width/2-w/2, screen.height/2-h/2);
  win.focus();
}


function writeEmail(user, host, country) {
document.write('<a class=artxt href=mailto:',user,'@',host,'.',country,'>',user,'@',host,'.',country,'</a>');
}

function writeEmailSelect(user, host, country, name) {
document.write('<option value=',user,'@',host,'.',country,'>',name,'</option>');
}


function ismaxlength(obj){
var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""
if (obj.getAttribute && obj.value.length>mlength) {
obj.value=obj.value.substring(0,mlength);
alert("Ati depasit lungimea maxima permisa pentru un comentariu!"); }
}

function showPopImage() {
document.getElementById("popimage").style.visibility = "visible";
setTimeout('hidePopImage()',3000);
}
function hidePopImage() {
document.getElementById("popimage").style.visibility = "hidden";
}



var liverefresh = 3000;
var livesize = 'sif';
var reloading = 0;
function reloadImage() {
  var now = new Date();
  if (document.images.pntlive1) { document.images.pntlive1.src = 'http://ramses:ramses@www.piatra-neamt-live.ro/images1' + livesize + '?ramdom=' + now.getTime(); }
  if (document.images.pntlive2) { document.images.pntlive2.src = 'http://t-i.ro/webcam.php?station=Piatra-Neamt&random=' + now.getTime(); }
}
function ReloadRefresh(dropdown1) {
    var myindex1  = dropdown1.selectedIndex;
    var SelValue1 = dropdown1.options[myindex1].value;
    liverefresh  = SelValue1;
	clearInterval(reloading);
	ReloadFirst();
}
function ReloadSize(dropdown2) {
    var myindex2  = dropdown2.selectedIndex;
    var SelValue2 = dropdown2.options[myindex2].value;
    livesize  = SelValue2;
	reloadImage();
}
function ReloadFirst() {
  reloading = setInterval('reloadImage()',liverefresh);
  var now = new Date();
  if (document.images.pntlive1) { document.images.pntlive1.src = 'http://ramses:ramses@www.piatra-neamt-live.ro/images1' + livesize + '?ramdom=' + now.getTime(); }
  if (document.images.pntlive2) { document.images.pntlive2.src = 'http://t-i.ro/webcam.php?station=Piatra-Neamt&random=' + now.getTime(); }
}


function insert_bbcode(v){
	try {
		if (document.selection){
			var str = document.selection.createRange().text;
			document.forms['updfrm'].elements['in_text'].focus();
			var sel = document.selection.createRange();
			sel.text = "<" + v + ">" + str + "</" + v + ">";
			return;
		}
		else if ((typeof document.forms['updfrm'].elements['in_text'].selectionStart) != 'undefined') {
			var txtarea = document.forms['updfrm'].elements['in_text'];
			var selLength = txtarea.textLength;
			var selStart = txtarea.selectionStart;
			var selEnd = txtarea.selectionEnd;
			var s1 = (txtarea.value).substring(0,selStart);
			var s2 = (txtarea.value).substring(selStart, selEnd)
			var s3 = (txtarea.value).substring(selEnd, selLength);
			txtarea.value = s1 + '<' + v + '>' + s2 + '</' + v + '>' + s3;
			txtarea.selectionStart = s1.length;
			txtarea.selectionEnd = s1.length + 5 + s2.length + v.length * 2;
			return;
		}
		else {

		}
	}
	catch(e){
	}
}

function CreateBookmarkLink(url,title) {

  // title = "Webpage Title"; 
  // Blogger - Replace with <$BlogItemTitle$> 
  // MovableType - Replace with <$MTEntryTitle$>

  // url = "Webpage URL";
  // Blogger - Replace with <$BlogItemPermalinkURL$> 
  // MovableType - Replace with <$MTEntryPermalink$>
  // WordPress - <?php bloginfo('url'); ?>

	if (window.sidebar) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url,"");
	} else if( window.external ) { // IE Favorite
		window.external.AddFavorite( url, title); }
	else if(window.opera && window.print) { // Opera Hotlist
		return true; }
 }
