


// on document ready functions
$(document).ready(function(){
								
		if($.browser.msie){ 
			//if is IE web browser	 run corners modifier	
			$('.cbox').corner();
			$('.cbox-light').corner();
			$('.imageclass').corner();
			$('.pagination li').corner();
			$('#footer').corner();
		}
		
		if(!navigator.cookieEnabled){ if(!document.location.href.match(/not-allowed/g)){ document.location = 'http://'+document.domain+'/not-allowed/why/Cookies-need-to-be-enabled'; } }
		
		$("#tabs").tabs({cookie: {expires: 7},fx: {height: 'toggle',opacity:'toggle'}}).find('.ui-tabs-nav'); //tabs
		//$("#accmenu").accordion({ header: "h3", collapsible: true, navigation: true }); //account menu
		//$("#debugmenu").accordion({ autoHeight: false, active :9, collapsible: true, header: "h3" }); // debug menu
		
		// preset for icons to use default and active state
		$('ul#icons li').mouseover(function() { $(this).addClass('ui-state-hover'); }).mouseout(function(){ $(this).removeClass('ui-state-hover'); });
		
		
});









// regular jquery functions or extentions
$(function() {
					
		/*
		//fade option	
		$.effects.fade = function(faderopt) { 
			return this.queue(function() { 
				var jqfader = $(this);
				var speed = faderopt.options.speed || 230;
				var mode = faderopt.options.mode || 'show';
				if(mode == 'show'){ jqfader.fadeIn(speed); }else{ jqfader.fadeOut(speed); } 
				jqfader.queue('fx', function() { jqfader.dequeue(); }); 
				jqfader.dequeue(); 
			}); 
		}; 
			*/
			
		//fade toggle
		$.fn.fadeToggle = function(speed, easing, callback) { return this.animate({opacity: 'toggle'}, speed, easing, callback); }
		
		//tooltip
		var settitle,i = 0;
		$("#tooltips").mouseover(function(){
			settitle = $(this).attr("title");
			$("#tooltiper").remove();
			$("body").append('<div class="tooltip" id="tooltiper"><p>'+settitle+'</p></div>');
			$(this).removeAttr("title");
		}).mousemove(function(mousepos){
			var border_top = $(window).scrollTop();
			var border_right = $(window).width();
			var left_pos;
			var top_pos;
			var offset = 0;
				if(border_right - (offset *2) >= $("#tooltiper").width() + mousepos.pageX){
					left_pos = mousepos.pageX+offset;
				}else{
					left_pos = border_right-$("#tooltiper").width()-offset;
				}
				if(border_top + (offset *2)>= mousepos.pageY - $("#tooltiper").height()){
					top_pos = border_top +offset;
				}else{
					top_pos = mousepos.pageY-$("#tooltiper").height()-offset;
				}	
			$("#tooltiper").css({left:left_pos, top:top_pos, opacity:0.9, zIndex:9999});
		}).mouseout(function(){
			$(this).attr("title",settitle);
			$("#tooltiper").mouseout(function(){
				$(this).attr("title",settitle);
				$(this).fadeOut(400);
			});
		});
		

			
		// edit in place links
		$('#show_edit_inplace_links span').html('show');
		$('#show_edit_inplace_links span').click(function() { 
				if($('#show_edit_inplace_links').hasClass('edit_show_text')){			
					$('#show_edit_inplace_links span').html('show');
					$('#show_edit_inplace_links').removeClass('edit_show_text');
					$('#show_edit_inplace_links').addClass('edit_hide_text');
					$('.edit_this_holder').hide();
				}else{			   	
					$('#show_edit_inplace_links span').html('hide');
					$('#show_edit_inplace_links').removeClass('edit_hide_text');
					$('#show_edit_inplace_links').addClass('edit_show_text');
					$('.edit_this_holder').show();
				}
		 });

		
}); // end jquery functions









function urldecode( strtodecode ){
    var hm = {}, retstring = strtodecode.toString(), unicodeStr='', hexEscStr='';
    var replacer = function(search, replace, strtodecode){ var tmp_arrgs = []; tmp_arrgs = strtodecode.split(search); return tmp_arrgs.join(replace); };
		hm["'"]   = '%27'; hm['(']   = '%28'; hm[')']   = '%29'; hm['*']   = '%2A'; hm['~']   = '%7E'; hm['!']   = '%21';
		hm['%20'] = '+'; hm['\u00DC'] = '%DC'; hm['\u00FC'] = '%FC'; hm['\u00C4'] = '%D4';
		hm['\u00E4'] = '%E4'; hm['\u00D6'] = '%D6'; hm['\u00F6'] = '%F6'; hm['\u00DF'] = '%DF';
		hm['\u20AC'] = '%80'; hm['\u0081'] = '%81'; hm['\u201A'] = '%82'; hm['\u0192'] = '%83';
		hm['\u201E'] = '%84'; hm['\u2026'] = '%85'; hm['\u2020'] = '%86'; hm['\u2021'] = '%87';
		hm['\u02C6'] = '%88'; hm['\u2030'] = '%89'; hm['\u0160'] = '%8A'; hm['\u2039'] = '%8B';
		hm['\u0152'] = '%8C'; hm['\u008D'] = '%8D'; hm['\u017D'] = '%8E'; hm['\u008F'] = '%8F';
		hm['\u0090'] = '%90'; hm['\u2018'] = '%91'; hm['\u2019'] = '%92'; hm['\u201C'] = '%93';
		hm['\u201D'] = '%94'; hm['\u2022'] = '%95'; hm['\u2013'] = '%96'; hm['\u2014'] = '%97';
		hm['\u02DC'] = '%98'; hm['\u2122'] = '%99'; hm['\u0161'] = '%9A'; hm['\u203A'] = '%9B';
		hm['\u0153'] = '%9C'; hm['\u009D'] = '%9D'; hm['\u017E'] = '%9E'; hm['\u0178'] = '%9F';
    for (unicodeStr in hm){ hexEscStr = hm[unicodeStr]; retstring = replacer(hexEscStr, unicodeStr, retstring); }
    retstring = decodeURIComponent(retstring);
    return retstring;
}


function doPopup(url,w,h,s,l,t,stb){
	var day = new Date(); 
	var id = day.getTime();
	window.open(url, id ,"scrollbars="+ s +",width="+ w +",height="+ h +",left = "+ l +",top = "+ t +",location="+(stb==null ? "no" : "yes")+"");
}


function callback_return_btn(event,func_name){
	var func = new Object(func_name); 
	if((event.which && event.which == 13) || (event.keyCode && event.keyCode == 13)){ return this[func](); return false; }else{ return true; }	
}


document.getElementsByClassName = function(cl){
	var retnode = []; var myclass = new RegExp('\\b'+cl+'\\b'); var elem = this.getElementsByTagName('*');
	for (var i = 0; i < elem.length; i++){ var classes = elem[i].className; if (myclass.test(classes)){ retnode.push(elem[i]); } }
	return retnode;
};
