var docArray=["index.php","home.php"];var inpHead="new heading";var inpContent="new column information";var delImgId=0;var pPost="";String.prototype.trim=function(){return this.replace(/^\s*/,"").replace(/\s*$/,"")};$(document).ready(function(){$("form").setFormCss();if(CurrentDocName()==docArray[1]){$(".navSelect").corner("top 10px");$(".split3").append('<div class="splMask"><!-- --></div>').children(".splMask").animate({opacity:0.8},{duration:10,queue:false}).eq(0).css({display:"none"});$(".split3").eq(2).append('<iframe name="iFrm"></iframe>');$("body").append('<div class="pgeMask"><!-- --></div>').append('<div class="dialog"><div class="heading"><a href="#" class="close" title="close dialog">close dialog</a><h2><!-- --></h2></div><div id="content"></div></div>');$(".dialog").centreElm();$(".bciNav li a").click(function(){bcIndex=$(this).attr("rel");thsIndx=$(".bciNav li a").index(this);$.ajax({type:"POST",url:"media/scripts/php/process.php",data:"func=setBGid&pId="+bcIndex,success:function(){$(".bciNav li a").removeClass("navSelect").eq(thsIndx).addClass("navSelect").uncorner().corner("top 10px");$(".split3").eq(0).children("h2").text("Pub list: "+$(".bciNav li a").eq(thsIndx).text());RefreshPubNames()}});return false});$(".split3").eq(0).children("h2").text("Pub list: "+$(".bciNav li a").eq(0).text());$(".nvPubFoot .addto").eq(0).click(function(){$(".dialog .heading h2").text("Add new record");$(".dialog #content").append('<form action="#" class="frmAddPub"><input type="text" value="pub name" title="pub name" /><p class="formReturn">&nbsp;</p><input type="submit" value="add" /></form>').viewDialog().setFormCss();$(".dialog").centreElm({doAni:false});$(".frmAddPub").submit(function(){thsElm=$(this);thisInp=thsElm.children('input[type="text"]').eq(0);thsTitle=thisInp.attr("title");thisVal=thisInp.val();if(thisVal!=thsTitle&&thisVal!=""){thsElm.children(".formReturn").addClass("minload").text("Processing...").css({display:"block"});$.ajax({type:"POST",url:"media/scripts/php/process.php",data:"func=addpub&pubname="+thisVal,success:function(a){thsElm.children(".formReturn").removeClass("minload").text(a);RefreshPubNames()}})}return false});return false});$(".nvPubFoot .addto").eq(1).click(function(){$(".dialog .heading h2").text("Add image");$(".dialog #content").append('<form action="media/scripts/php/processImage.php" enctype="multipart/form-data" method="post" target="iFrm" class="frmImage"><input type="file" title="Image location" name="fileupload" /><p class="formReturn">&nbsp;</p><input type="submit" value="add" /></form>').viewDialog().setFormCss();$(".dialog").centreElm({doAni:false});$(".frmImage").submit(function(){thsElm=$(this);thsElm.children(".formReturn").addClass("minload").text("Processing...").css({display:"block"})});return false});$('.refreshImg p input[type="button"]').click(function(){RefreshImages();return false});$(document).keyup(function(a){if(a.keyCode==27){$(this).viewDialog({aniSpeed:200,show:false})}});$(".dialog .close").click(function(){$(this).viewDialog({aniSpeed:200,show:false})});$(".frmTxtContent").submit(function(){return false})}else{$(".liBox").centreElm({aniSpeed:10,easing:"linear"}).corner()}$(window).bind("load",function(){if(CurrentDocName()==docArray[1]){refreshBCtopNav();$(".pgeMask, .dialog").animate({opacity:0},{duration:10,queue:false});SetSplitHeights()}}).bind("resize",function(){if(CurrentDocName()==docArray[1]){$(".dialog").centreElm()}else{$(".liBox").centreElm()}});$(".frmTxtContent").submit(function(){return false});$('.frmTxtContent input[type="button"]').click(function(){thsName=$(this);frmTxtElm=$('.frmTxtContent p input[type="text"],.frmTxtContent p textarea');arrInput=frmTxtElm.eq(0).val()+"{spl}"+frmTxtElm.eq(1).val()+"{spl}"+frmTxtElm.eq(2).val()+"{spl}"+frmTxtElm.eq(3).val()+"{spl}"+frmTxtElm.eq(4).val();pstStr=arrInput.replace("&","and");thsName.parent().children(".formReturn").text("Processing...").addClass("minload").css({display:"block"});$.ajax({type:"POST",url:"media/scripts/php/process.php",data:"func=updaterec&inputNfo="+pstStr,success:function(a){thsName.parent().children(".formReturn").text(a).removeClass("minload")}});return false});$('.frmSetLocation input[type="button"]').click(function(){if($.browser.msie&&$.browser.version=="7.0"){setWid=735}else{setWid="auto"}$(".dialog .heading h2").text("Map Location: record "+recId);$(".dialog #content").empty().append('<div class="mapLocation"><a href="#" class="pointer">Location pointer</a><input type="button" value="Update" /><p class="processInfo minload">Retrieving...</p></div>').viewDialog({setWidth:setWid}).setFormCss();$(".dialog").centreElm({doAni:false});$(".mapLocation .pointer").applyPointerPos();$(".mapLocation .pointer").animate({opacity:0},{duration:10,queue:false}).click(function(){return false}).draggable().parent().droppable({drop:function(){pTop=$(this).children(".pointer").css("top");pLeft=$(this).children(".pointer").css("left");pPost=pLeft+","+pTop}});$('.mapLocation input[type="button"]').click(function(){$.ajax({type:"POST",url:"media/scripts/php/process.php",data:"func=updatelocation&pPost="+pPost,success:function(a){if(a){$(this).viewDialog({show:false})}else{alert("update error")}}});return false});return false});$('.frmTxtContent p input[type="text"], .frmTxtContent p textarea').keyup(function(){frmOk=true;$('.frmTxtContent p input[type="text"],.frmTxtContent p textarea').each(function(){thsVal=$(this).val().trim();if(thsVal==inpHead||thsVal==inpContent){frmOk=false}else{if(frmOk){frmOk=true}}});if(frmOk){$('.frmTxtContent input[type="button"]').css({display:"block"})}else{$('.frmTxtContent input[type="button"]').css({display:"none"})}});$("#frmLogin").submit(function(){elmName=$("#frmLogin .txtbox");liFrmVals=new Array(elmName.eq(0).val(),elmName.eq(1).val());if(CheckEmail(liFrmVals[0])&&liFrmVals[1]!=""){$.ajax({type:"POST",url:"media/scripts/php/li.php",data:"func:li&vals="+liFrmVals.toString(),success:function(a){if(a){$("#frmLogin #uliresult").text("Redirecting...");window.location=docArray[1]}else{$("#frmLogin #uliresult").text("User was not found.")}}})}return false});$("a").click(function(){thisLink=$(this).attr("href");thisRel=$(this).attr("rel");if(thisLink!=""&&thisLink!=" "&&thisLink!="#"){if(thisRel=="nw"){window.open(thisLink)}else{window.location=thisLink}}return false});$("img").mouseover(function(){if($(this).attr("title")!=undefined){titleStr=$(this).attr("title");$(this).removeAttr("title")}}).mouseout(function(){if(titleStr!=""){$(this).attr("title",titleStr);titleStr=""}})});(function(a){a.fn.extend({centreElm:function(b){var c={easing:"easeInOutExpo",aniSpeed:300,doAni:true};var b=a.extend(c,b);return this.each(function(){var i=b.easing;var j=b.aniSpeed;var g=b.doAni;var k=a(this);var d=k.height();var f=k.width();var e=a(window).height();var h=a(window).width();if(g){doAniSpeed=j}else{doAniSpeed=10}k.animate({top:((e/2)-(d/2)),left:((h/2)-(f/2))},{duration:doAniSpeed,easing:i,queue:false})})},viewDialog:function(b){var c={easing:"easeInOutExpo",aniSpeed:300,show:true,setWidth:300};var b=a.extend(c,b);return this.each(function(){var d=b.easing;var e=b.aniSpeed;var g=b.show;var g=b.show;var f=b.setWidth;if(g){a(".pgeMask").css({display:"block"}).animate({opacity:0.7},e,d,function(){a(".dialog").css({display:"block",width:f}).animate({opacity:1},{duration:e,queue:false,easing:d})})}else{a(".dialog").animate({opacity:0},e,d,function(){a(this).css({display:"none"}).children("#content").empty();a(".pgeMask").animate({opacity:0},e,d,function(){a(this).css({display:"none"})})})}})},setFormCss:function(){a('input[type="text"], textarea, input[type="password"]').focus(function(){a(this).css({color:"#000000",backgroundColor:"#fddfa3"})}).blur(function(){a(this).css({color:"#9f999b",backgroundColor:"#f5f5f5"})});a('input[type="submit"], input[type="button"]').mouseover(function(){a(this).css({color:"#000000",backgroundColor:"#fddfa3"})}).mouseout(function(){a(this).css({color:"#9f999b",backgroundColor:"#f5f5f5"})})},setLiPub:function(b){var c={aniSpeed:300};var b=a.extend(c,b);return this.each(function(){var e=b.aniSpeed;var d=a(this);if(a.browser.msie){d.children(".nvPubEdt").css({display:"block"})}else{d.children(".nvPubEdt").animate({opacity:0},10,function(){a(this).css({display:"block"}).animate({opacity:1},{duration:e,queue:false})})}})},applyImgClick:function(){thsSrc=a(this).attr("src");if(a.browser.msie&&jQuery.browser.version=="7.0"){setWid=640}else{setWid="auto"}a(".dialog .heading h2").text("View Image");a(".dialog #content").empty().append('<img src="'+thsSrc+'" rel="#" />').viewDialog({setWidth:setWid}).setFormCss();a(".dialog").centreElm({doAni:false})},applyPointerPos:function(){thsNme=a(this);a.ajax({type:"POST",url:"media/scripts/php/process.php",data:"func=getPointyerPos",success:function(b){splStr=b.split(",");if(splStr.length>0){posL=splStr[0];posT=splStr[1]}else{posL="10px";posT="10px"}thsNme.css({left:posL,top:posT});a(".mapLocation .processInfo").removeClass("minload").text("").parent().children(".pointer").animate({opacity:1},{duration:300,queue:false})}})}})})(jQuery);function CheckEmail(a){AtPos=a.indexOf("@");StopPos=a.lastIndexOf(".");if(AtPos==-1||StopPos==-1){return false}else{return true}}function CurrentDocName(){thisURL=document.location.href;strUrl=thisURL.split("/");strUrl=strUrl.pop().split("?");strUrl=strUrl[0].split("#");return strUrl[0]}function RefreshPubNames(){$(".split3").eq(0).children("#pubNfo").html('<p class="minload">Retrieving list please wait...</p>');$(".split3 .splMask").css({display:"block"}).animate({opacity:0.8},{duration:300,queue:false}).eq(0).css({display:"none"});$(".split3 .formReturn").css({display:"none"});$(".innerImages").html("");$('.frmTxtContent input[type="text"], .frmTxtContent textarea').val("");$.ajax({type:"POST",url:"media/scripts/php/process.php",data:"func=publist",success:function(a){$(".split3").eq(0).children("#pubNfo").html(a);$(".nvPub>li>a").mouseover(function(){thsElm=$(this).parent();if(thsElm.children(".nvPubEdt").size()==0){recId=$(this).attr("rel");$(".nvPub li").children(".cb, .nvPubEdt").remove();thsElm.prepend('<ul class="nvPubEdt"><li><a href="#" class="lEdit" rel="'+recId+'" title="edit record">edit</a></li><li><a href="#" class="lView" rel="'+recId+'" title="view record">view</a></li><li><a href="#" class="lRemove" rel="'+recId+'" title="remove record">remove</a></li></ul>').append('<div class="cb"><!-- --></div>').setLiPub()}$(".nvPub>li>ul>li>a").click(function(){$(".split3 .formReturn").css({display:"none"});thsNme=$(this);selIndx=$(".nvPub>li>ul>li>a").index(this);recId=thsNme.attr("rel");if(selIndx==0){$(".split3 .splMask").css({display:"block"}).animate({opacity:0.8},{duration:300,queue:false}).eq(0).css({display:"none"});$(".imgRefresh").css({display:"none"});$(".nvPub li a").removeClass("txtSelected").children("span").remove();thsNme.parent().parent().parent().children("a").addClass("txtSelected nfoLoad").append("<span>(Editing)</span>");$.ajax({type:"POST",url:"media/scripts/php/process.php",data:"func=editrec&pId="+recId,success:function(b){splStr=b.split("{spl}");secNme=$(".frmTxtContent p");secNme.children('input[type="text"]').eq(0).val(splStr[0]);secNme.children('input[type="text"]').eq(1).val(splStr[1]);secNme.children("textarea").eq(0).val(splStr[2]);secNme.children("textarea").eq(1).val(splStr[3]);secNme.children("textarea").eq(2).val(splStr[11]);$(".split3 .splMask").animate({opacity:0},300,function(){$(this).css({display:"none"})});thsNme.parent().parent().parent().children("a").removeClass("nfoLoad")}});RefreshImages()}else{if(selIndx==1){window.open("../viewpub/index.php?pubId="+recId)}else{if(selIndx==2){$(".dialog .heading h2").text("Remove record: "+recId);$(".dialog #content").empty().append('<form action="#" class="frmDelRec"><p>Are you sure you want to remove this record?</p><input type="hidden" value="'+recId+'" id="secID" /><p class="formReturn">&nbsp;</p><input type="submit" value="yes" /><input type="button" value="no" /></form>').viewDialog().setFormCss();$(".dialog").centreElm({doAni:false});$(".frmDelRec").submit(function(){recId=$(this).children("#secID").val();$(this).children(".formReturn").addClass("minload").text("Processing...").css({display:"block"});$.ajax({type:"POST",url:"media/scripts/php/process.php",data:"func=removerec&pId="+recId,success:function(){RefreshPubNames();$(this).viewDialog({aniSpeed:200,show:false})}});return false});$('.frmDelRec input[type="button"]').click(function(){$(this).viewDialog({aniSpeed:200,show:false})})}}}return false})})}})}function refreshBCtopNav(){$.ajax({type:"POST",url:"media/scripts/php/process.php",data:"func=refreshBcTop",success:function(a){$(".bciNav li a").removeClass("navSelect").eq(a).addClass("navSelect").uncorner().corner("top 10px");$(".split3").eq(0).children("h2").text("Pub list: "+$(".bciNav li a").eq(a).text());RefreshPubNames()}})}function SetSplitHeights(){spl3He2=$(".split3").eq(2).children(".innerImages").height()+70;spl3He=spl3He2;$(".split3").uncorner().each(function(){if($(this).height()>spl3He&&$(this).height()>spl3He2){spl3He=$(this).height()}}).height(spl3He).corner()}function RefreshImages(){$(".split3").eq(2).children(".innerImages").html('<p class="minload">Retrieving images please wait...</p>');$(".imgRefresh").css({display:"none"});$.ajax({type:"POST",url:"media/scripts/php/process.php",data:"func=returnImages",success:function(a){if(a!=""){imgSecHtml=a}else{imgSecHtml="<p>There are currently no images listed on this record.</p>"}$(".split3").eq(2).children(".innerImages").html(imgSecHtml);$(".photo_sec img").attr("alt","");SetSplitHeights();$(".photo_sec img").click(function(){$(this).applyImgClick()}).mouseover(function(){delImgId=$(".photo_sec img").index(this);$(".photo_sec").children(".cb, .imageNav").remove();$(this).parent().prepend('<ul class="imageNav"><li><a href="#" class="lRemove" rel="'+recId+'" title="remove record">remove</a></li></ul>').append('<div class="cb"><!-- --></div>').children(".imageNav").css({display:"block"});$(".imageNav>li>a").click(function(){$(".dialog .heading h2").text("Remove image");$(".dialog #content").empty().append('<form action="#" class="frmDelRec"><p>Are you sure you want to remove this image?</p><input type="hidden" value="'+delImgId+'" id="secID" /><p class="formReturn">&nbsp;</p><input type="submit" value="yes" /><input type="button" value="no" /></form>').viewDialog().setFormCss();$(".dialog").centreElm({doAni:false});$(".frmDelRec").submit(function(){$(this).children(".formReturn").addClass("minload").text("Processing...").css({display:"block"});$.ajax({type:"POST",url:"media/scripts/php/process.php",data:"func=removeRecImg&imgId="+delImgId,success:function(b){if(b){$(this).viewDialog({aniSpeed:200,show:false});$(".split3").eq(2).children(".innerImages").html("")}else{alert("there was an error")}$(".imgRefresh").css({display:"block"})}});return false});$('.frmDelRec input[type="button"]').click(function(){$(this).viewDialog({aniSpeed:200,show:false})});return false})})}})};
