﻿function isEmpty(e){return!e.length;}function isEmptyJQ(e){return isEmpty($(e).val());}function equals(s,t){return s==t;}function hideel(e,e1){$(e).addClass("hidden");if(e1!=undefined)hideel(e1);}function poppic(s){window.open("http://c.xss.in/show.html?"+s,"","resizable=1,HEIGHT=200,WIDTH=200");}function popvideo(lang){window.open("http://rax.lv/video/video-"+lang+".html","myWindow","status = 1, height = 410, width = 540, resizable = 0");}function renderdefaults(el){el=(el==undefined)?"":el+" ";$(el+"a.open").not(".binded").addClass("binded").click(function(cur){hidethirdparty();var url=$(this).attr("href")+"?"+Math.random();var pos=$(this).attr("rel");$("#"+pos).removeClass("hidden").html("");$.get(url,null,function(e){$("#"+pos).html(e);});document.location.hash="header";return false;});$(el+".cancel").not(".binded").addClass("binded").click(function(){hidethirdparty();return false;});$(el+".delete").not(".binded").addClass("binded").click(function(){var question=$(this).attr("title");if(confirm(question)){var url=$(this).attr("href");var pos=$(this).attr("rel");var hide=url.substring(url.lastIndexOf('/')+1);$.get(url,null,function(e){if(pos.length>5)$("#"+pos).html(e).removeClass("hidden");});$("#delete-item-"+hide).addClass("hidden");}return false;});}function hidethirdparty(){$("#first").addClass("hidden").html("");$("#second").addClass("hidden").html("");}function hidefirst(){if(!$("#first").hasClass("hidden"))$("#first").addClass("hidden").html("");}function renderdefaultform(){$("form").addClass("binded").submit(function(){$("#first").addClass("hidden");$.post($(this).attr("action"),$(this).serialize(),function(e){if(equals(e,"True")){hidethirdparty();}else if(e.match("invalid")){$("#first").removeClass("hidden").html(e);}else $("#second").removeClass("hidden").html(e);});return false;});}function rendercontent(to,from){$(document).ready(function(){$("#"+to).removeClass("hidden");$.get(from,null,function(e){$("#"+to).html(e);renderdefaults("#"+to);});});}function hideel(el){if(!$(el).hasClass("hidden"))$(el).addClass("hidden");}function resetfileform(filecontainer,fileid){var parent=document.getElementById(filecontainer);var newFileInput=document.createElement('input');parent.removeChild(document.getElementById(fileid));newFileInput.setAttribute('type','file');newFileInput.setAttribute('id',fileid);newFileInput.setAttribute('name',fileid);parent.appendChild(newFileInput);}function hoverlink(el,className){$(el).hover(function(){$(this).addClass(className);},function(){$(this).removeClass(className);});}function supportAnchort(){$(document).ready(function(){$("#helpdesk-bottom").html("support&#"+(1==1?"x"+"40":"3")+";weblapas.lv");});}