function lightrow(prm) {
	prm.className='lightUp';
	prm.style.cursor='pointer';
}
function setback(prm, clas) {
	prm.className=clas;
}
function insertText(elname, what, formname) {
	if(formname == undefined)
		formname = 'inputform';
	if(document.forms[formname].elements[elname].createTextRange) {
		document.forms[formname].elements[elname].focus();
		document.selection.createRange().duplicate().text = what;
	}
	else if((typeof document.forms[formname].elements[elname].selectionStart) != 'undefined') {
		var tarea = document.forms[formname].elements[elname];
		var selEnd = tarea.selectionEnd;
		var txtLen = tarea.value.length;
		var txtbefore = tarea.value.substring(0,selEnd);
		var txtafter = tarea.value.substring(selEnd, txtLen);
		var oldScrollTop = tarea.scrollTop;
		tarea.value = txtbefore + what + txtafter;
		tarea.selectionStart = txtbefore.length + what.length;
		tarea.selectionEnd = txtbefore.length + what.length;
		tarea.scrollTop = oldScrollTop; tarea.focus();
	}
	else {
	document.forms[formname].elements[elname].value += what;
	document.forms[formname].elements[elname].focus();
	}
}
function getposOffset(overlay, offsettype) { var totaloffset=(offsettype=='left')? overlay.offsetLeft : overlay.offsetTop; var parentEl=overlay.offsetParent; while (parentEl!=null) { if(getStyle(parentEl, "position") != "relative"){ totaloffset=(offsettype=='left')? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;}
parentEl=parentEl.offsetParent;}
return totaloffset;}
function overlay(curobj, subobjstr, opt_position) { if (document.getElementById){ var subobj=document.getElementById(subobjstr)
subobj.style.display=(subobj.style.display!='block')? 'block' : 'none'
var xpos=getposOffset(curobj, 'left')+((typeof opt_position!='undefined' && opt_position.indexOf('right')!=-1)? -(subobj.offsetWidth-curobj.offsetWidth) : 0)
var ypos=getposOffset(curobj, 'top')+((typeof opt_position!='undefined' && opt_position.indexOf('bottom')!=-1)? curobj.offsetHeight : 0)
subobj.style.left=xpos+'px'
subobj.style.top=ypos+'px'
return false
}
else
return true
}
function getStyle(el,style) { if(typeof el == "string")
var element = document.getElementById(el); else
var element = el; if (element.currentStyle)
var value = element.currentStyle[style]; else if (window.getComputedStyle)
var value = document.defaultView.getComputedStyle(element,null).getPropertyValue(style); return value;}
function DraugiemSay( title, url, titlePrefix ) { window.open( 'http://www.draugiem.lv/say/ext/add.php?title=' + encodeURIComponent( title ) + '&link=' + encodeURIComponent( url ) + ( titlePrefix ? '&titlePrefix=' + encodeURIComponent( titlePrefix ) : '' ), '', 'location=1,status=1,scrollbars=0,resizable=0,width=530,height=400' ); return false;}
function checkUncheckAll(theElement) { var theForm = theElement.form, z = 0; for(z=0; z<theForm.length;z++){ if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall'){ theForm[z].checked = theElement.checked;}
}
}
(function($) {
    $.fn.filestyle = function(options) {
        var settings = {
            width : 250
        };
        if(options) {
            $.extend(settings, options);
        };       
        return this.each(function() {
            var self = this;
            var wrapper = $("<div>")
                            .css({
                                "width": settings.imagewidth + "px",
                                "height": settings.imageheight + "px",
                                "background": "url(" + settings.image + ") 0 0 no-repeat",
                                "background-position": "right",
                                "display": "inline",
                                "position": "absolute",
                                "overflow": "hidden"
                            });
            var filename = $('<input class="faila_lauks" disabled="disabled">')
                             .addClass($(self).attr("class"))
                             .css({
                                 "display": "inline",
                                 "width": settings.width + "px"
                             });
            $(self).before(filename);
            $(self).wrap(wrapper);
            $(self).css({
                        "position": "relative",
                        "height": settings.imageheight + "px",
                        "width": settings.width + "px",
                        "display": "inline",
                        "cursor": "pointer",
                        "opacity": "0.0"
                    });
            if ($.browser.mozilla) {
                if (/Win/.test(navigator.platform)) {
                    $(self).css("margin-left", "-142px");                    
                } else {
                    $(self).css("margin-left", "-168px");                    
                };
            } else {
                $(self).css("margin-left", settings.imagewidth - settings.width + "px");                
            };
            $(self).bind("change", function() {
                filename.val($(self).val());
            });
        });
    };
})(jQuery);
  $(function() {
      $("input[type=file]").filestyle({ 
          image: "css/images/browse_poga.png",
          imageheight : 21,
          imagewidth : 55,
          width : 100
      });   
  });
$(document).ready(function() {
	var refreshId = setInterval(function() {
		$('#online_ajakss').load('/includes/online_panelis.php?rand='+ Math.random());
	}, 10000);
});

function irIE7() {
if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){
	var parlukaVersija=new Number(RegExp.$1)
	var parlukaVards=navigator.appName;
	if(parlukaVards=="Microsoft Internet Explorer" && parlukaVersija<=7) {
		return true;
	}
	else {
		return false;
	}
}
else {
	return false;
}
}

if(irIE7()) {
$(document).ready(function(){
	$(".iframe_profils").colorbox({width:"340px", height:"425px;", iframe:true});
	$(".iframe_bilde").colorbox({width:"410px", height:"300px;", iframe:true});
	$(".iframe_registracija").colorbox({width:"340px", height:"515px;", iframe:true});
	$(".iframe_ziedo").colorbox({width:"360px", height:"250px;", iframe:true});
	$(".iframe_parole").colorbox({width:"340px", height:"215px;", iframe:true});
	$(".iframe_darbvirsma").colorbox({width:"520px", height:"575px;", iframe:true});
	$(".iframe_reklamas").colorbox({width:"400px", height:"510px;", iframe:true});
	$(".iframe_anekdote").colorbox({width:"365px", height:"270px;", iframe:true});
	$(".iframe_webkamera").colorbox({width:"644px", height:"535px;", iframe:true});
	$(".iframe_kontakti").colorbox({width:"335px", height:"320px;", iframe:true});
	$(".tv_kanals").colorbox();
	$(".lietotaja_bildex").colorbox();
	$("a[rel=\'portfolio\']").colorbox();
}); 
}
else {
$(document).ready(function(){
	$(".iframe_profils").colorbox({width:"340px", height:"390px;", iframe:true});
	$(".iframe_bilde").colorbox({width:"410px", height:"275px;", iframe:true});
	$(".iframe_registracija").colorbox({width:"360px", height:"485px;", iframe:true});
	$(".iframe_ziedo").colorbox({width:"360px", height:"250px;", iframe:true});
	$(".iframe_parole").colorbox({width:"340px", height:"180px;", iframe:true});
	$(".iframe_darbvirsma").colorbox({width:"520px", height:"535px;", iframe:true});
	$(".iframe_reklamas").colorbox({width:"390px", height:"450px;", iframe:true});
	$(".iframe_anekdote").colorbox({width:"365px", height:"230px;", iframe:true});
	$(".iframe_webkamera").colorbox({width:"644px", height:"505px;", iframe:true});
	$(".iframe_kontakti").colorbox({width:"335px", height:"285px;", iframe:true});
	$(".tv_kanals").colorbox();
	$(".lietotaja_bildex").colorbox();
	$("a[rel=\'portfolio\']").colorbox();
}); 
}

function niknaisOnlineris(){
	$.post('/includes/onliner.php');
}
setInterval('niknaisOnlineris()', 60000);

function niknaisPlay(links){
	window.location=links;
	$.post('/tikko.php?links='+links);
}
$(document).ready(function(){
    $("div.foruma_sadala").mouseover(function(){
    	$(this).css('background-color','#d5e4ff');
    }).mouseout(function(){
    	$(this).css('background-color','white');
    });
});