/*OBLONGTECH 2010-02-24 JAVASCRIPT LIBRARY V3 REQUIRES =>JQUERY 1.3.2*/
/*Edited By Dustin 201003121705*/

jQuery.noConflict();
//####################################################################################################
/*jquery.extend.js*/
jQuery.fn.extend(
{
sib:function(n){ return jQuery(this.get(0).parentNode.childNodes).eq(jQuery(this.get(0).parentNode.childNodes).index(this.get(0))+n); }
,next:function(){ n = this.get(0); while((n = n.nextSibling) && n.nodeType != 1); return jQuery(n); }
/*,next:function(){
 var arr = [];
 for(var i=0;i<this.size();i++){
  n = this.get(i); while((n = n.nextSibling) && n.nodeType != 1); arr[i] = n;
  }
 return jQuery(arr);
 }*/
,prev:function(){ if(this.size()>0){ n = this.get(0); while((n = n.previousSibling) && n.nodeType != 1); return jQuery(n); }else{ return jQuery(); } }
//,parent:function(){  }
}
);

//####################################################################################################
/*jquery.cookies.js*/
function cookie(name,val,options){if(typeof val!="undefined"){options=options||{};if(val===null){val="";options.expires=-1}var e="";if(options.expires&&(typeof options.expires=="number"||options.expires.toUTCString)){var f;if(typeof options.expires=="number"){f=new Date();f.setTime(f.getTime()+(options.expires*24*60*60*1000))}else{f=options.expires}e="; expires="+f.toUTCString()}var l=options.path?"; path="+(options.path):"";var g=options.domain?"; domain="+(options.domain):"";var a=options.secure?"; secure":"";document.cookie=[name,"=",encodeURIComponent(val),e,l,g,a].join("")}else{var d=null;if(document.cookie&&document.cookie!=""){var k=document.cookie.split(";");for(var h=0;h<k.length;h++){var c=jQuery.trim(k[h]);if(c.substring(0,name.length+1)==(name+"=")){d=decodeURIComponent(c.substring(name.length+1));break}}}return d}};
function cookies(a,v,options){ if(isArray(a)&&typeof(v)!="undefined"){ o={}; for(var i in a){ o[a[i]]=v; } a=o; for(var c in a){ cookie(c,a[c]); } }else{ return cookie(a,v,options); }; }
jQuery.cookie = cookie;//function(n,v,o){return cookies(a,v,options);}

//####################################################################################################
/*jquery.easing.js*/
jQuery.extend(jQuery.easing,{def:"easeOutQuad",jswing:"swing",swing:function(e,f,a,h,g){return jQuery.easing[jQuery.easing.def](e,f,a,h,g)},easeInQuad:function(e,f,a,h,g){return h*(f/=g)*f+a},easeOutQuad:function(e,f,a,h,g){return -h*(f/=g)*(f-2)+a},easeInOutQuad:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f+a}return -h/2*((--f)*(f-2)-1)+a},easeInCubic:function(e,f,a,h,g){return h*(f/=g)*f*f+a},easeOutCubic:function(e,f,a,h,g){return h*((f=f/g-1)*f*f+1)+a},easeInOutCubic:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f+a}return h/2*((f-=2)*f*f+2)+a},easeInQuart:function(e,f,a,h,g){return h*(f/=g)*f*f*f+a},easeOutQuart:function(e,f,a,h,g){return -h*((f=f/g-1)*f*f*f-1)+a},easeInOutQuart:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f*f+a}return -h/2*((f-=2)*f*f*f-2)+a},easeInQuint:function(e,f,a,h,g){return h*(f/=g)*f*f*f*f+a},easeOutQuint:function(e,f,a,h,g){return h*((f=f/g-1)*f*f*f*f+1)+a},easeInOutQuint:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f*f*f+a}return h/2*((f-=2)*f*f*f*f+2)+a},easeInSine:function(e,f,a,h,g){return -h*Math.cos(f/g*(Math.PI/2))+h+a},easeOutSine:function(e,f,a,h,g){return h*Math.sin(f/g*(Math.PI/2))+a},easeInOutSine:function(e,f,a,h,g){return -h/2*(Math.cos(Math.PI*f/g)-1)+a},easeInExpo:function(e,f,a,h,g){return(f==0)?a:h*Math.pow(2,10*(f/g-1))+a},easeOutExpo:function(e,f,a,h,g){return(f==g)?a+h:h*(-Math.pow(2,-10*f/g)+1)+a},easeInOutExpo:function(e,f,a,h,g){if(f==0){return a}if(f==g){return a+h}if((f/=g/2)<1){return h/2*Math.pow(2,10*(f-1))+a}return h/2*(-Math.pow(2,-10*--f)+2)+a},easeInCirc:function(e,f,a,h,g){return -h*(Math.sqrt(1-(f/=g)*f)-1)+a},easeOutCirc:function(e,f,a,h,g){return h*Math.sqrt(1-(f=f/g-1)*f)+a},easeInOutCirc:function(e,f,a,h,g){if((f/=g/2)<1){return -h/2*(Math.sqrt(1-f*f)-1)+a}return h/2*(Math.sqrt(1-(f-=2)*f)+1)+a},easeInElastic:function(f,h,e,l,k){var i=1.70158;var j=0;var g=l;if(h==0){return e}if((h/=k)==1){return e+l}if(!j){j=k*0.3}if(g<Math.abs(l)){g=l;var i=j/4}else{var i=j/(2*Math.PI)*Math.asin(l/g)}return -(g*Math.pow(2,10*(h-=1))*Math.sin((h*k-i)*(2*Math.PI)/j))+e},easeOutElastic:function(f,h,e,l,k){var i=1.70158;var j=0;var g=l;if(h==0){return e}if((h/=k)==1){return e+l}if(!j){j=k*0.3}if(g<Math.abs(l)){g=l;var i=j/4}else{var i=j/(2*Math.PI)*Math.asin(l/g)}return g*Math.pow(2,-10*h)*Math.sin((h*k-i)*(2*Math.PI)/j)+l+e},easeInOutElastic:function(f,h,e,l,k){var i=1.70158;var j=0;var g=l;if(h==0){return e}if((h/=k/2)==2){return e+l}if(!j){j=k*(0.3*1.5)}if(g<Math.abs(l)){g=l;var i=j/4}else{var i=j/(2*Math.PI)*Math.asin(l/g)}if(h<1){return -0.5*(g*Math.pow(2,10*(h-=1))*Math.sin((h*k-i)*(2*Math.PI)/j))+e}return g*Math.pow(2,-10*(h-=1))*Math.sin((h*k-i)*(2*Math.PI)/j)*0.5+l+e},easeInBack:function(e,f,a,i,h,g){if(g==undefined){g=1.70158}return i*(f/=h)*f*((g+1)*f-g)+a},easeOutBack:function(e,f,a,i,h,g){if(g==undefined){g=1.70158}return i*((f=f/h-1)*f*((g+1)*f+g)+1)+a},easeInOutBack:function(e,f,a,i,h,g){if(g==undefined){g=1.70158}if((f/=h/2)<1){return i/2*(f*f*(((g*=(1.525))+1)*f-g))+a}return i/2*((f-=2)*f*(((g*=(1.525))+1)*f+g)+2)+a},easeInBounce:function(e,f,a,h,g){return h-jQuery.easing.easeOutBounce(e,g-f,0,h,g)+a},easeOutBounce:function(e,f,a,h,g){if((f/=g)<(1/2.75)){return h*(7.5625*f*f)+a}else{if(f<(2/2.75)){return h*(7.5625*(f-=(1.5/2.75))*f+0.75)+a}else{if(f<(2.5/2.75)){return h*(7.5625*(f-=(2.25/2.75))*f+0.9375)+a}else{return h*(7.5625*(f-=(2.625/2.75))*f+0.984375)+a}}}},easeInOutBounce:function(e,f,a,h,g){if(f<g/2){return jQuery.easing.easeInBounce(e,f*2,0,h,g)*0.5+a}return jQuery.easing.easeOutBounce(e,f*2-g,0,h,g)*0.5+h*0.5+a}});

//####################################################################################################
/*jquery.urlparser.js*/
jQuery.url=function(){var segments={};var parsed={};var options={url:window.location,strictMode:false,key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}};var parseUri=function(){str=decodeURI(options.url);var m=options.parser[options.strictMode?"strict":"loose"].exec(str);var uri={};var i=14;while(i--){uri[options.key[i]]=m[i]||""}uri[options.q.name]={};uri[options.key[12]].replace(options.q.parser,function($0,$1,$2){if($1){uri[options.q.name][$1]=$2}});return uri};var key=function(key){if(!parsed.length){setUp()}if(key=="base"){if(parsed.port!==null&&parsed.port!==""){return parsed.protocol+"://"+parsed.host+":"+parsed.port+"/"}else{return parsed.protocol+"://"+parsed.host+"/"}}return(parsed[key]==="")?null:parsed[key]};var param=function(item){if(!parsed.length){setUp()}return(parsed.queryKey[item]===null)?null:parsed.queryKey[item]};var setUp=function(){parsed=parseUri();getSegments()};var getSegments=function(){var p=parsed.path;segments=[];segments=parsed.path.length==1?{}:(p.charAt(p.length-1)=="/"?p.substring(1,p.length-1):path=p.substring(1)).split("/")};return{setMode:function(mode){strictMode=mode=="strict"?true:false;return this},setUrl:function(newUri){options.url=newUri===undefined?window.location:newUri;setUp();return this},segment:function(pos){if(!parsed.length){setUp()}if(pos===undefined){return segments.length}return(segments[pos]===""||segments[pos]===undefined)?null:segments[pos]},attr:key,param:param}}();

//####################################################################################################
/*misc.js*/
function isFunction(fn){ return typeof(fn)=='function'&&(!Function.prototype.call||typeof(fn.call)=='function'); }
function isElement(e){ return e&&typeof(e)=='object'&&e.nodeType==1&&e.constructor==document.createElement(e.nodeName).constructor; }

//####################################################################################################
/*string.js*/
String.prototype.mreplace = function(hash_table){
 var a = []; for(var key in hash_table){ a[a.length] = key; }
 var regexp = a.join('|');
 return this.replace( new RegExp(regexp,'g'), function(m,l){ return hash_table[m] || hash_table["\\"+m]; });
 }

function camelCase(str){ return str.toString().replace(/([A-Z]+)/g, function(m,l){return l.substr(0,1).toUpperCase() + l.toLowerCase().substr(1,l.length);}).replace(/[\&\.\-\_\=\+\s\?](.?)/g, function(m, l){return l.toUpperCase();}); }

function rand_string(len,chars){
 var chars = typeof(chars)=='undefined' || !chars || chars=='' ? "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz" : chars ;
 var len = typeof(len)!='number' ? 8 : len ;
 var randomstring = '';
 for(var i=0; i<len; i++){
  var rnum = Math.floor(Math.random() * chars.length);
  randomstring += chars.substring(rnum,rnum+1);
  }
 return randomstring;
 }

//####################################################################################################
/*array.js*/

function keyofval(obj,val){ for(var i in obj){ if(obj[i]==val){ return i; } } return -1; }

Array.prototype.concatnest = function(){
 var b = []; for(var c in this){ if(isArray(this[c])){ b = b.concat(this[c].concatnest()); }else{ b.push(this[c]); } }; return b;
 }
Array.prototype.minval = function(start,end){
 start = start || 0 ; end = end || a.length;
 var min = a[start];
 for(var i=start;i<end;i++){ min = (a[i]<min) ? a[i] : min ; }
 return min;
 }
Array.prototype.maxval = function(start,end){
 start = start || 0 ; end = end || a.length;
 var max = a[start];
 for(var i=start;i<end;i++){ max = (a[i]>max) ? a[i] : max ; }
 return max;
 }
Array.prototype.sortnum = function(){ return this.sort( function(a,b){ return a-b; } ); }
Array.prototype.print = function(){ var str=''; for(var i in this){ /*if(lvl>0&&isArray(obj[i])){}*/ str+=i+' = '+typeof(this[i])+'<br/>'; } return str;  }

//####################################################################################################
/*elements.js*/

function getElem(elemID){
 if(document.getElementById){return document.getElementById(elemID);}
 else if(document.all){return document.all[elemID];}
 else if(document.layers) {return document.layers[elemID];}
 else{alert('Browser Doesn\'t Support DOM')}
 }
function removeElem(e){
 if(typeof(e)=='string') e = getElem(e);
 if(e && e.nodeName.toLowerCase()=='iframe'){ try{ delete window.frames[e.name]; } catch(error){  }; }
 if(e) e.parentNode.removeChild(e);
 }

function nextSib(n){ while((n = n.nextSibling) && n.nodeType != 1); return n; }
function prevSib(n){ while((n = n.previousSibling) && n.nodeType != 1); return n; }

function parseElems(a){ var c = []; var j=0; for(i=0;i<a.length;i++){ if(a[i].nodeType!=3){ c[j++]=a[i]; } } return c; }

function unique_id(){var id='REF_'+rand_string();while(jQuery('#'+id).size()>0)id='REF_'+rand_string(); return id;}
function unique_classname(){var id='REF_'+rand_string();while(jQuery('.'+id).size()>0)id='REF_'+rand_string(); return id;}

//####################################################################################################
/*keyevents.js*/

var KEYNAMES = {13:'ENTER',9:'TAB',16:'SHIFT',38:'ARROWUP',40:'ARROWDOWN',8:'BACKSPACE',46:'DELETE'};
var KEYCODES = {}; for(var k in KEYNAMES){ KEYCODES[KEYNAMES[k]] = k; }

function keyCode(evt){ var evt = ( window.event || evt ); var key = ( evt.keyCode || evt.charCode || evt.which || 0 ); return key; }
function isKey(evt,n){ return ( keyCode(evt)==(n = (typeof(n)=='string' ? KEYCODES[n.replace(/[^a-zA-Z 0-9]+/g,'').replace(/[ ]+/g,' ').toUpperCase()] : n )) ? true : false ); }

var isShiftKeyHeld = false;
jQuery(document).bind('keydown',function(event){if(isKey(event,'SHIFT') && !isShiftKeyHeld) isShiftKeyHeld = true; });
jQuery(document).bind('keyup',function(event){if(isKey(event,'SHIFT')) isShiftKeyHeld = false; });

function stopEvent(event){if(window.event){/*IE*/ window.event.cancelBubble=true;window.event.returnValue=false;}else{event.preventDefault();event.stopPropagation();}return false;}
cancelBubble = preventDefault = cancelEvent = stopEvent;

function cancelTabKey(event){ if(isKey(event,'tab')){ return !stopEvent(event); } else return false; }

//#################################################################################################### 
/*imagepreloader.js*/
function MM_preloadImages(){//v3.0
 var d = document;
 if(d.images){
  if(!d.MM_p) d.MM_p = new Array();
  var i,j = d.MM_p.length, a = MM_preloadImages.arguments;
  for(i=0;i<a.length;i++){
   if(a[i].indexOf("#")!=0){
    d.MM_p[j] = new Image;
    d.MM_p[j++].src = a[i];
 }}}}

//####################################################################################################
/*php.js*/
function strip_tags(str,allowedtags){var m="",j=false;var f=[];var a=[];var l="";var d=0;var c="";var e="";var b=function(k,i,n){return n.split(k).join(i)};if(allowedtags){a=allowedtags.match(/([a-zA-Z0-9]+)/gi)}str+="";f=str.match(/(<\/?[\S][^>]*>)/gi);for(m in f){if(isNaN(m)){continue}e=f[m].toString();j=false;for(c in a){l=a[c];d=-1;if(d!=0){d=e.toLowerCase().indexOf("<"+l+">")}if(d!=0){d=e.toLowerCase().indexOf("<"+l+" ")}if(d!=0){d=e.toLowerCase().indexOf("</"+l)}if(d==0){j=true;break}}if(!j){str=b(e,"",str)}}return str};
function is_array(q){return q&&q.constructor!=null&&q.constructor==Array;}
function in_array(needle,haystack){for(var i in haystack){if(haystack[i]==needle){return true;}}return false;}

function nl2br(str){ return str.toString().replace(/\r\n/g,'<br/>').replace(/[\r\n]/g,'<br/>'); }
function br2nl(html){ return html.toString().replace(/<br\s*\/?>/mg,"\r\n"); }

function urlencode(str){	return encodeURIComponent((str+'').toString()).replace(/!/g,'%21').replace(/'/g,'%27').replace(/\(/g,'%28').replace(/\)/g,'%29').replace(/\*/g,'%2A').replace(/%20/g,'+')/*.replace(/~/g, '%7E')*/; }
function urldecode(str){ return decodeURIComponent(str.replace(/\+/g, '%20')); }

function htmlentities(html){/*OBLONGTECH CUSTOM*/
 return html.toString()
 .replace(/&/g,'&amp;')
 .replace(/</g,'&lt;')
 .replace(/>/g,'&gt;')
 .replace(/"/g,'&quot;');
 }
function htmlspecialchars_decode(string){ return string.toString().split('&quot;').join('"').split('&lt;').join('<').split('&gt;').join('>').split('&amp;').join('&'); }


/*######################################################################*/
/*rte.js*/
function initRTE(elem){

	jQuery(elem).tinymce({
		init_instance_callback : function(rte){ jQuery(rte.getContainer()).css({'visibility':'visible'}); },
		
		script_url : 'js/tiny_mce/tiny_mce.js',
		content_css : 'css/tinymce-frame.css',
		theme : 'advanced', skin : 'o2k7',			
		
		plugins : 'safari,save,inlinepopups,style,paste,preview,fullscreen',
		
		paste_auto_cleanup_on_paste : true,
		paste_preprocess : function(pl, o){
			o.content = strip_tags('<p>'+o.content.replace(/<\/div>/g,'</div><br/>')+'</p>','<br><hr><em><i><strong><b><p><h1><h2><a><img><strike><u>');
			},
		paste_block_drop : true,
		paste_strip_class_attributes : 'all',
		paste_remove_spans : true,
		paste_remove_styles : true,
		
		theme_advanced_buttons1 : 'bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,indent,outdent,forecolor,backcolor,removeformat,|,hr,|,link,unlink,|,image', theme_advanced_buttons2 : false, theme_advanced_buttons3 : false,
		theme_advanced_toolbar_location : 'top', theme_advanced_toolbar_align : 'left', theme_advanced_statusbar_location : 'bottom',
		theme_advanced_resizing : true, theme_advanced_resize_horizontal : false
		
		,setup : function(ed){
			ed.onKeyDown.add(function(ed,e){ if(e.ctrlKey && (e.keyCode == 83 || e.KeyCode == 115)){ stopEvent(event); return false; }; });
			}
		});

 }

/*######################################################################*/
/*ajax_form.js*/
function ajax_form(form){
 if(!document.getElementById('ajax_formpost_container')){
  var i = document.createElement('div'); i.id = 'ajax_formpost_container'; i.style.display = 'none'; document.body.appendChild(i);
  }
 else{ var i = document.getElementById('ajax_formpost_container'); }
 
 if(document.getElementById('ajax_formpost_iframe')){ removeElem('ajax_formpost_iframe'); }
 
 i.innerHTML = '<iframe name="ajax_formpost_iframe" src="init.html" id="ajax_formpost_iframe" style="display:none;" onload="setTimeout(function(){ ajax_form_iframe_onload(); },1);"></iframe>';
 form.target = 'ajax_formpost_iframe';
 form.submit();
 }
function ajax_form_iframe_onload(){ var i = window.frames.ajax_formpost_iframe || document.getElementById('ajax_formpost_iframe').contentWindow ; if( i.init() ){ ajax_form_iframe_delete(); } };
function ajax_form_iframe_delete(){ removeElem('ajax_formpost_iframe'); removeElem('ajax_formpost_container'); }


