// JavaScript Document
(function($){$.fn.mousehold=function(timeout,f){if(timeout&&typeof timeout=='function'){f=timeout;timeout=100;}
if(f&&typeof f=='function'){var timer=0;var fireStep=0;return this.each(function(){var clearMousehold=function(){clearInterval(timer);if(fireStep==1)f.call(this,1);fireStep=0;};$(this).mousedown(function(){fireStep=1;var ctr=0;var t=this;timer=setInterval(function(){ctr++;f.call(t,ctr);fireStep=2;},timeout);}).mouseout(clearMousehold).mouseup(clearMousehold);});}};})(jQuery);$(function(){function hex2rgb(hexStr){var hex=parseInt(hexStr.substring(1),16);var r=(hex&0xff0000)>>16;var g=(hex&0x00ff00)>>8;var b=hex&0x0000ff;return[r,g,b];}
function rgb2hex(rgb){rgb=rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);function hex(x){return("0"+parseInt(x).toString(16)).slice(-2);}
return"#"+hex(rgb[1])+hex(rgb[2])+hex(rgb[3]);}
function rgba2hex(rgb){rgb=rgb.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+))?\)$/);function hex(x){return("0"+parseInt(x).toString(16)).slice(-2);}
return"#"+hex(rgb[1])+hex(rgb[2])+hex(rgb[3]);}
$('.close_popup_overlay').live('click',function(){$('#popup_overlay').hide();});function hide_animated_hide_div(){setTimeout(function(){$('.animate_hide').animate({opacity:0.2},2000,function(){$('.animate_hide').slideUp('slow');});},1000);}
$("ul.link_cluster").sortable({connectWith:'ul.link_cluster',handle:'.link_container',cancel:'.note_wrap',update:function(element,ui){var link_cluster_ids=$(this).sortable('toArray');var parent_id_list=$(this).parents().map(function(){return this.id;}).get().join(", ");$('#ajax_working').animate({opacity:1},10).show();$.ajax({url:'ajax/AJ_update_link_order.php',data:'link_cluster_ids='+link_cluster_ids+'&parents='+parent_id_list,type:'POST',success:function(results){$('#ajax_working').animate({opacity:0},1000).hide(1000);if(results=="not logged in"){$('#popup_overlay').show();$('#popup_overlay_message_area').html("<p>Sorry, You are not logged in.  <a href='"+URL_PATH+"'>Please log in</a>.</p>");}}});}});$('.columnlist').mousehold(300,function(){$('.columnlist').addClass('columnlist_border');});$('.columnlist').live('mouseup',function(){$('.columnlist').removeClass('columnlist_border');});$(".columnlist").sortable({connectWith:'.columnlist',handle:'.group_header',opacity:0.50,update:function(element,ui){var group_cluster_ids=$(this).sortable('toArray');var parent_id_list=$(this).parents().map(function(){return this.id;}).get().join(", ");$('#ajax_working').animate({opacity:1},10).show();$.ajax({url:'ajax/AJ_update_group_order.php',data:'group_cluster_ids='+group_cluster_ids+'&parents='+parent_id_list,type:'POST',success:function(results){$('#ajax_working').animate({opacity:0},1000).hide(1000);if(results=="not logged in"){$('#popup_overlay').show();$('#popup_overlay_message_area').html("<p>Sorry, You are not logged in.  <a href='"+URL_PATH+"'>Please log in</a>.</p>");}}});}});$('#save_options').click(function(){var input_num_columns=$('#updateoptions select:#num_columns').val();var input_rss_entries=$('#updateoptions select:#rss_entries').val();var input_userID=$('#updateoptions input:#userID').val();$("#update_options_working").animate({opacity:1},1000).show();$.ajax({url:'update_useroptions.php',data:'num_columns='+input_num_columns+'&rss_entries='+input_rss_entries+'&userID='+input_userID,type:'POST',success:function(results){$('#update_options_working').animate({opacity:0},1000).hide(10,function(){$('#update_options_form').animate({opacity:0},100).slideUp();$('#update_results').animate({opacity:0},1).append("<div id='response'>"+results+"</div>").animate({opacity:1},2000)});}});});$('#save_account').click(function(){var input_fname=$('#updateaccount input:#fname').val();var input_lname=$('#updateaccount input:#lname').val();var input_address=$('#updateaccount input:#address').val();var input_city=$('#updateaccount input:#city').val();var input_state=$('#updateaccount input:#state').val();var input_zip=$('#updateaccount input:#zip').val();var input_email=$('#updateaccount input:#email').val();var input_password=$('#updateaccount input:#password').val();var input_phone=$('#updateaccount input:#phone').val();var input_userID=$('#updateaccount input:#userID').val();$("#update_account_working").animate({opacity:1},1000).show();$.ajax({url:'update_userinfo.php',data:'fname='+input_fname+'&lname='+input_lname+'&address='+input_address+'&city='+input_city+'&state='+input_state+'&zip='+input_zip+'&email='+input_email+'&password='+input_password+'&phone='+input_phone+'&userID='+input_userID,type:'POST',success:function(results){$('#update_account_working').animate({opacity:0},1000).hide(10,function(){$('#account_info_form').animate({opacity:0},100).slideUp();$('#account_results').animate({opacity:0},1).append("<div id='response'>"+results+"</div>").animate({opacity:1},2000)});}});});$('#updateaccount input:#email').keyup(function(){var input=$(this).val();if($(this).attr('id')=="email"){var input_type='email';}else{var input_type='text';};var input_id="#"+$(this).attr('id');$('#email_input_checker_results').replaceWith("<div id='email_input_checker_results'><img src='../images/ajax_loader.gif' /></div>")
$.ajax({url:'verify_input_info.php',data:'input='+input+'&input_type='+input_type,type:'POST',success:function(results){$('#email_input_checker_results').replaceWith("<div id='email_input_checker_results'>"+results+"</div>");if(results=="Good"){$('#email_input_checker_results').fadeOut(2000);$(input_id).removeClass("errorField");}
if(results=="Error"){$(input_id).addClass("errorField");}}});});$('.edit_this_group').live('click',function(){var groupID=$(this).attr('data-group_id');var group_name=$('#group_title_'+groupID).html();var group_bgcolor=$('#group_header_'+groupID).css('background-color');var hex=rgb2hex(group_bgcolor);var group_form='<div class="edit_group_wrap" id="edit_group_wrap_'+groupID+'" >'+'<h3>Edit this Group</h3>'+'<p>'+'<input name="group_name_'+groupID+'" id="group_name_'+groupID+'" '+'type="text" value="'+group_name+'" size="20" >'+'</p>'+'<p>'+'<input name="group_color_'+groupID+'" id="group_color_'+groupID+'" '+'type="text" value="'+hex+'" size="7" > '+'<span class="hex_desc">Hex color value (ie. #FFF000)</span>'+'</p>'+'<div id="colorpicker_'+groupID+'"></div>'+'<p>Favorite Colors</p>'+'<div class="color_fav" data-group_id="'+groupID+'"> Loading Colors.... <img src="images/ajax_loader.gif">'+'</div>'+'<div class="clearfloat"></div> '+'<p>'+'<input type="button" id="save_group_info" class="button2 save_group_info" '+'data-group_id="'+groupID+'" value="Save">   '+'<input type="button" class="button save_color_to_fav" '+'data-group_id="'+groupID+'" value="Add Color To Favorites">   '+'<input type="button" name="close_popup" class="button close_popup_overlay" value="Close">'+'</p>'+'<p class="group_delete">  '+'<input type="button" class="button delete_this_group" '+'data-group_id="'+groupID+'" value="Delete This Group">'+'</p>'+'</div>';$('#popup_overlay').show();$('#popup_overlay_message_area').html(group_form);$('#colorpicker_'+groupID).farbtastic('#group_color_'+groupID);$.ajax({url:'ajax/AJ_get_fav_colors.php',data:'groupID='+groupID,type:'POST',success:function(results){if(results=="error"){$('#popup_overlay').show();$('#popup_overlay_message_area').html("<p>Sorry, You are not logged in.  <a href='"+URL_PATH+"'>Please log in</a>.</p>");}else{$('.color_fav').html(results);}}});return false;});$('.save_group_info').live('click',function(){var groupID=$(this).attr('data-group_id');var groupName=$('#group_name_'+groupID).val();var styles=$('#group_color_'+groupID).attr("style");var styles_arr=styles.split("; ");var rgb_background=styles_arr[0];var rgb_color=styles_arr[1];var rgb_background=rgb_background.replace("background-color: ","");var rgb_color=rgb_color.replace("color: ","");var rgb_color=rgb_color.replace(";","");var hex=$('#group_color_'+groupID).val();$("#ajax_working").animate({opacity:1},1000).show();$.ajax({url:'ajax/AJ_update_group_info.php',data:'groupID='+groupID+'&rgb_background='+rgb_background+'&rgb_color='+rgb_color+'&groupName='+groupName,type:'POST',success:function(results){if(results=="good"){$('#ajax_working').animate({opacity:0},1000).hide(10,function(){});$('#group_header_'+groupID).css({'background-color':hex});$('#group_header_'+groupID).css({'color':rgb_color});$('#group_title_'+groupID).html(groupName);$('#popup_overlay').hide();}else{$('#popup_overlay').show();$('#popup_overlay_message_area').html("<p>Sorry, You are not logged in.  <a href='"+URL_PATH+"'>Please log in</a>.</p>");}}});return false;});$('.color_sample').live('click',function(){var color=$(this).attr('data-color');var groupID=$(this).attr('data-group_id');$('#group_color_'+groupID).val(color);var press=jQuery.Event("keyup");press.keyCode=16;$('#group_color_'+groupID).focus();$('#group_color_'+groupID).trigger(press);return false;});$('.save_color_to_fav').live('click',function(){var groupID=$(this).attr('data-group_id');var styles=$('#group_color_'+groupID).attr("style");var styles_arr=styles.split("; ");var rgb_background=styles_arr[0];var rgb_color=styles_arr[1];var rgb_background=rgb_background.replace("background-color: ","");var hex=rgb2hex(rgb_background);$("#ajax_working").animate({opacity:1},1000).show();$.ajax({url:'ajax/AJ_save_fav_color.php',data:'hex='+hex,type:'POST',success:function(results){if(results=="good"){$('#ajax_working').animate({opacity:0},1000).hide(10,function(){});$('.color_fav').each(function(){var this_groupID=$(this).attr('data-group_id')
$(this).append('<div class="color_sample" style="background-color:'+hex+'" data-color="'+hex+'"data-group_id="'+this_groupID+' " ></div>');});}else{$('#popup_overlay').show();$('#popup_overlay_message_area').html("<p>Sorry, You are not logged in.  <a href='"+URL_PATH+"'>Please log in</a>.</p>");}}});return false;});$('.remove_fav_color').live('click',function(){var fav_color_id=$(this).attr('data-fav_color_id');var this_fav_color=$(this).parent();this_fav_color.css('border','3px solid red');var r=confirm("Are you sure you would like to delete this favorite color?");if(r==true){$('#ajax_working').animate({opacity:1},10).show();$.ajax({url:'ajax/AJ_delete_fav_color.php',data:'fav_color_id='+fav_color_id,type:'POST',datatype:'html',success:function(results){if(results=="not logged in"){$('#popup_overlay').show();$('#popup_overlay_message_area').html("<div class='error_box'><p>Sorry, You are not logged in.  <a href='"+URL_PATH+"'>Please log in</a>.</p></div>");}else if(results=="error"){$('#opt_bg_message_area').html("<div class='error_box'>Sorry, there was a problem saving your information.  Please login again.</div>");}else{$('#ajax_working').animate({opacity:0},1000).hide(1000);this_fav_color.animate({opacity:0},1000);this_fav_color.slideUp('slow');this_fav_color.remove();}}});}else{this_fav_color.css('border','thin solid #000000');}
return false;});$('.add_link_this_group').live('click',function(){var groupID=$(this).attr('data-group_id');var link_form='<div class="add_link_wrap" id="add_link_wrap_'+groupID+'" >'+'<h3>Add a Link</h3>'+'<div id="add_link_form" class="add_link_form">'+'<form id="addlink_'+groupID+'" name="addlink_'+groupID+'" method="post" action="">'+'<p>Link Name:<br>'+'<input type="text" name="link_name_'+groupID+'" id="link_name_'+groupID+'" '+' class="link_name" value=""/>'+'</p>'+'<p>'+'Link Url:<br>'+'<input type="text" name="link_url_'+groupID+'" id="link_url_'+groupID+'" '+'class="link_url" data-group_id="'+groupID+'"  value=""/>'+'</p>'+'<p>'+'Type:<br>'+'<input name="link_type_'+groupID+'" type="radio" value="reg" checked> Regular'+'<input name="link_type_'+groupID+'" type="radio" value="rss"> RSS Feed'+'</p>'+'<p>'+'Target:<br>'+'<input name="url_target_'+groupID+'" type="radio" value="blank" checked> New Window or Tab '+'<input name="url_target_'+groupID+'" type="radio" value="pop"> Pop up Window'+'</p>'+'<p>'+'Notes:<br>'+'<textarea name="link_notes_'+groupID+'" id="link_notes_'+groupID+'" cols="30" rows="3"></textarea>'+'</p>'+'<p>'+'<input type="button" name="save_link_this_group_'+groupID+'" '+'id="save_link_this_group_'+groupID+'" class="button2 save_link_this_group" '+'data-group_id="'+groupID+'"  value="Save"/>'+'   '+'<input type="button" name="close_popup" class="button close_popup_overlay" value="Close">'+'</p>'+'</form> '+'</div> '+'</div>';$('#popup_overlay').show();$('#popup_overlay_message_area').html(link_form);return false;});$('.save_link_this_group').live('click',function(){var groupID=$(this).attr('data-group_id');var link_name=$('#link_name_'+groupID).val();var link_url=$('#link_url_'+groupID).val();var link_type=$('input[name="link_type_'+groupID+'"]:checked').val();var url_target=$('input[name="url_target_'+groupID+'"]:checked').val();var link_notes=$('#link_notes_'+groupID).val();$("#ajax_working").animate({opacity:1},1000).show();$.ajax({url:'ajax/AJ_add_link_to_group.php',data:'groupID='+groupID+'&link_name='+link_name+'&link_url='+link_url+'&link_type='+link_type+'&url_target='+url_target+'&link_notes='+link_notes,type:'POST',success:function(results){if(results=="error"){$('#popup_overlay').show();$('#popup_overlay_message_area').html("<p>Sorry, You are not logged in.  <a href='"+URL_PATH+"'>Please log in</a>.</p>");}else{$('#ajax_working').animate({opacity:0},1000).hide(10,function(){});$('#link_cluster_'+groupID).prepend(results);$('#popup_overlay').hide();}}});return false;});$('.delete_this_link').live('click',function(){var link_id=$(this).attr('id');var parent=$(this).parent("div").parent("div").parent("div").parent("div").parent("li");parent.animate({'backgroundColor':'#fb6c6c'},1000,function(){var r=confirm("Are you sure you would like to delete this link?");if(r==true){$('#ajax_working').animate({opacity:1},10).show();$.ajax({url:'ajax/AJ_delete_link_info.php',data:'link_id='+link_id,type:'POST',beforeSend:function(){parent.animate({'backgroundColor':'#fb6c6c'},1000);},success:function(results){if(results=="not logged in"){$('#popup_overlay').show();$('#popup_overlay_message_area').html("<p>Sorry, You are not logged in.  <a href='"+URL_PATH+"'>Please log in</a>.</p>");}else{var results_arr=results.split("|");if(results_arr[0]=="error"){$('#popup_overlay').show();$('#popup_overlay_message_area').html("<p>Sorry, there was an error: "+results_arr[1]+"</p>");}else{parent.animate({opacity:0},1000);parent.slideUp('slow');parent.remove();$('#ajax_working').animate({opacity:0},1000).hide(1000);}}}});}else{parent.animate({'backgroundColor':'#ccfeb6'},500,function(){parent.animate({'backgroundColor':'#ffffff'},500);});}});return false;});$('.edit_this_link').live('click',function(){var linkID=$(this).attr('data-link_id');$.ajax({url:'ajax/AJ_get_link_info.php',data:'linkID='+linkID,type:'POST',success:function(results){if(results=="error"){$('#popup_overlay').show();$('#popup_overlay_message_area').html("<p>Sorry, You are not logged in.  <a href='"+URL_PATH+"'>Please log in</a>.</p>");}else{$('#popup_overlay').show();$('#popup_overlay_message_area').html(results);}}});return false;});$('.save_link').live('click',function(){var linkID=$(this).attr('data-link_id');var form_element=$(this).parent().parent().attr('id');var link_name=$('#'+form_element).find('.link_name').val();var link_url=$('#'+form_element).find('.link_url').val();var link_type=$('#'+form_element).find('input[name="link_type_'+linkID+'"]:checked').val();var url_target=$('#'+form_element).find('input[name="url_target_'+linkID+'"]:checked').val();var link_notes=$('#'+form_element).find('#link_notes_'+linkID).val();var sublink_list=$('#'+form_element).find('#sublink_list');var star_image_id=$('.star_'+linkID+' img').attr('id');var star_image=$('.star_'+linkID+' img').attr('src');var index=parseInt(0);var sub_array=new Array;$(sublink_list).children().each(function(index){var this_sublink_name=$(this).find('#sublinkname').val();var this_sublinkurl=$(this).find('#sublinkurl').val();var this_sublink_target=$(this).find('input[name="sub_link_url_target_'+index+'"]:checked').val();sub_array[index]={};sub_array[index]['name']=this_sublink_name;sub_array[index]['url']=this_sublinkurl;sub_array[index]['target']=this_sublink_target;var index=(Number(index)+Number(1));});var sub_array_json_text=JSON.stringify(sub_array);$("#ajax_working").animate({opacity:1},1000).show();$.ajax({url:'ajax/AJ_update_link_info.php',data:jQuery.extend({linkID:linkID},{link_name:link_name},{link_url:link_url},{link_type:link_type},{url_target:url_target},{link_notes:link_notes},{star_image_id:star_image_id},{star_image:star_image},{sub_array:sub_array_json_text}),type:'POST',success:function(results){if((results=="error")||(results=="not logged in")){$('#popup_overlay').show();$('#popup_overlay_message_area').html("<p>Sorry, You are not logged in.  <a href='"+URL_PATH+"'>Please log in</a>.</p>");}else{$('#ajax_working').animate({opacity:0},1000).hide(10,function(){});$('#link_item_'+linkID).replaceWith(results);$('#popup_overlay').hide();}}});return false;});$('#add_sublink').live("click",function(){var count=$(this).attr('data-sublink_count');var form="<li>Link Name:<br />"+"<input type='text' size = '40' id='sublinkname' name='sub_link_name[]' value=''/><br />"+"Link URL:<br />"+"<input type='text' size = '40' id='sublinkurl' name='sub_link_url[]' value=''/><br>"+"Target:<br />"+"<input name='sub_link_url_target_"+count+"' type='radio' value='blank' checked> New Window or Tab  "+"<input name='sub_link_url_target_"+count+"' type='radio' value='pop' > Pop up Window"+"</li>";$('#sublink_list').append(form);var newcount=(Number(count)+Number(1));$(this).attr('data-sublink_count',newcount)
return false;});$('.hide_group').live("click",function(){var group_id=$(this).attr('data-group_id');var the_group_wrapper="#group_wrapper_"+group_id;var this_parent=$(this).parent("span");var this_parent_siblings=$(this).parent("span").siblings("span");$("#ajax_working").animate({opacity:1},1000).show();$(the_group_wrapper).slideUp();$(this_parent).hide();$(this_parent_siblings).show();$.ajax({url:'ajax/AJ_update_group_open_close.php',data:'group_id='+group_id+'&group_open_close=close',type:'POST',success:function(results){$('#ajax_working').animate({opacity:0},1).hide(1,function(){});}});return false;});$('.show_group').live("click",function(){var group_id=$(this).attr('data-group_id');var the_group_wrapper="#group_wrapper_"+group_id;var this_parent=$(this).parent("span");var this_parent_siblings=$(this).parent("span").siblings("span");$("#ajax_working").animate({opacity:1},1000).show();$(the_group_wrapper).slideDown();$(this_parent).hide();$(this_parent_siblings).show();$.ajax({url:'ajax/AJ_update_group_open_close.php',data:'group_id='+group_id+'&group_open_close=open',type:'POST',success:function(results){$('#ajax_working').animate({opacity:0},1).hide(1,function(){});}});return false;});$('#add_group').click(function(){$("#ajax_working").animate({opacity:1},1000).show();$.ajax({url:'ajax/AJ_add_group.php',data:'',type:'POST',success:function(results){if(results=="error"){$('#popup_overlay').show();$('#popup_overlay_message_area').html("<p>Sorry, You are not logged in.  <a href='"+URL_PATH+"'>Please log in</a>.</p>");}else{$('#columnlist_1').prepend(results);$('.link_cluster').sortable({connectWith:'.link_cluster',handle:'.link_container',cancel:'.note_wrap',update:function(element,ui){var link_cluster_ids=$(this).sortable('toArray');var parent_id_list=$(this).parents().map(function(){return this.id;}).get().join(", ");$('#ajax_working').animate({opacity:1},10).show();$.ajax({url:'ajax/AJ_update_link_order.php',data:'link_cluster_ids='+link_cluster_ids+'&parents='+parent_id_list,type:'POST',success:function(results){$('#ajax_working').animate({opacity:0},1000).hide(1000);if(results=="not logged in"){$('#popup_overlay').show();$('#popup_overlay_message_area').html("<p>Sorry, You are not logged in.  <a href='"+URL_PATH+"'>Please log in</a>.</p>");}}});}});$('#ajax_working').animate({opacity:0},1000).hide(10,function(){$(results).find('.link_cluster').sortable("refresh");});}}});return false;});$('.delete_this_group').live("click",function(){var groupID=$(this).attr('data-group_id');var r=confirm("Are you sure you would like to delete this group with all of the links in it?");if(r==true){$('#ajax_working').animate({opacity:1},10).show();$.ajax({url:'ajax/AJ_delete_group_and_links.php',data:'groupID='+groupID,type:'POST',beforeSend:function(){$('#popup_overlay').hide();},success:function(results){if(results=="not logged in"){$('#popup_overlay').show();$('#popup_overlay_message_area').html("<p>Sorry, You are not logged in.  <a href='"+URL_PATH+"'>Please log in</a>.</p>");}else{var results_arr=results.split("|");if(results_arr[0]=="error"){$('#popup_overlay').show();$('#popup_overlay_message_area').html("<p>Sorry, there was an error: "+results_arr[1]+"</p>");}else{$('li#'+groupID).animate({opacity:0},1000);$('li#'+groupID).slideUp('slow',function(){$('li#'+groupID).remove();});$('#ajax_working').animate({opacity:0},1000).hide(1000);}}}});}else{}
return false;});$('.note_icon').live('click',function(){var link_id=$(this).attr('id');$("#note_wrapper_"+link_id).slideToggle();return false;});$('.user_options').click(function(){$('.option_tab').css('background-color','#000000');$('#user_options_window_wrap').toggle('slow',function(){$('#opt_tab_options').animate({'backgroundColor':'#74a75c'},20);$('#option_cat_options').stop().animate({opacity:0},0).show().animate({opacity:1},500);$('#option_win_close_wrap').stop().animate({opacity:0},0).show().animate({opacity:1},500);$('#option_cat_qlink').hide();$('#option_cat_backgrounds').hide();$('#option_cat_info').hide();});return false;});$('.option_tab').click(function(){$('.option_tab').animate({'backgroundColor':'#000000'},20);$(this).animate({'backgroundColor':'#74a75c'},20);});$('#opt_tab_options').click(function(){$('#option_cat_options').stop().animate({opacity:0},0).show().animate({opacity:1},500);$('#option_win_close_wrap').stop().animate({opacity:0},0).show().animate({opacity:1},500);$('#option_cat_qlink').hide();$('#option_cat_backgrounds').hide();$('#option_cat_info').hide();});$('#opt_tab_qlink').click(function(){$('#option_cat_qlink').stop().animate({opacity:0},0).show().animate({opacity:1},500);$('#option_win_close_wrap').stop().animate({opacity:0},0).show().animate({opacity:1},500);$('#option_cat_options').hide();$('#option_cat_backgrounds').hide();$('#option_cat_info').hide();});$('#opt_tab_backgrounds').click(function(){$('#option_cat_backgrounds').stop().animate({opacity:0},0).show().animate({opacity:1},500);$('#option_win_close_wrap').stop().animate({opacity:0},0).show().animate({opacity:1},500);$('#option_cat_options').hide();$('#option_cat_qlink').hide();$('#option_cat_info').hide();$('#colorpicker_page_background').farbtastic('#page_bg_color');});$('#opt_tab_info').click(function(){$('#option_cat_info').stop().animate({opacity:0},0).show().animate({opacity:1},500);$('#option_cat_options').hide();$('#option_cat_qlink').hide();$('#option_cat_backgrounds').hide();$('#option_win_close_wrap').hide();});$('.options_col').click(function(){var columns=$(this).val();$("#column_1").stop();$("#column_2").stop();$("#column_3").stop();$("#column_4").stop();$("#column_5").stop();$("#column_6").stop();$("#column_7").stop();var calc_column_width=(100/columns)+"%";var ani_width=1000;var ani_opacity=1000;if(columns==1){$("#column_2").animate({opacity:0},ani_opacity);$("#column_3").animate({opacity:0},ani_opacity);$("#column_4").animate({opacity:0},ani_opacity);$("#column_5").animate({opacity:0},ani_opacity);$("#column_6").animate({opacity:0},ani_opacity);$("#column_7").animate({opacity:0},ani_opacity,function(){$("#column_1").animate({width:calc_column_width},ani_width);});}else if(columns==2){$("#column_3").animate({opacity:0},ani_opacity);$("#column_4").animate({opacity:0},ani_opacity);$("#column_5").animate({opacity:0},ani_opacity);$("#column_6").animate({opacity:0},ani_opacity);$("#column_7").animate({opacity:0},ani_opacity,function(){$("#column_1").animate({width:calc_column_width},ani_width);$("#column_2").animate({width:calc_column_width},ani_width,function(){$("#column_2").animate({opacity:1},ani_opacity).show('slow');});});}else if(columns==3){$("#column_4").animate({opacity:0},ani_opacity);$("#column_5").animate({opacity:0},ani_opacity);$("#column_6").animate({opacity:0},ani_opacity);$("#column_7").animate({opacity:0},ani_opacity,function(){$("#column_1").animate({width:calc_column_width},ani_width);$("#column_2").animate({width:calc_column_width},ani_width,function(){$("#column_2").animate({opacity:1},ani_opacity).show('slow');});$("#column_3").animate({width:calc_column_width},ani_width,function(){$("#column_3").animate({opacity:1},ani_opacity).show('slow');});});}else if(columns==4){$("#column_5").animate({opacity:0},ani_opacity);$("#column_6").animate({opacity:0},ani_opacity);$("#column_7").animate({opacity:0},ani_opacity,function(){$("#column_1").animate({width:calc_column_width},ani_width);$("#column_2").animate({width:calc_column_width},ani_width,function(){$("#column_2").animate({opacity:1},ani_opacity).show('slow');});$("#column_3").animate({width:calc_column_width},ani_width,function(){$("#column_3").animate({opacity:1},ani_opacity).show('slow');});$("#column_4").animate({width:calc_column_width},ani_width,function(){$("#column_4").animate({opacity:1},ani_opacity).show('slow');});});}else if(columns==5){$("#column_6").animate({opacity:0},ani_opacity);$("#column_7").animate({opacity:0},ani_opacity,function(){$("#column_1").animate({width:calc_column_width},ani_width);$("#column_2").animate({width:calc_column_width},ani_width,function(){$("#column_2").animate({opacity:1},ani_opacity).show('slow');});$("#column_3").animate({width:calc_column_width},ani_width,function(){$("#column_3").animate({opacity:1},ani_opacity).show('slow');});$("#column_4").animate({width:calc_column_width},ani_width,function(){$("#column_4").animate({opacity:1},ani_opacity).show('slow');});$("#column_5").animate({width:calc_column_width},ani_width,function(){$("#column_5").animate({opacity:1},ani_opacity).show('slow');});});}else if(columns==6){$("#column_7").animate({opacity:0},ani_opacity,function(){$("#column_1").animate({width:calc_column_width},ani_width);$("#column_2").animate({width:calc_column_width},ani_width,function(){$("#column_2").animate({opacity:1},ani_opacity).show('slow');});$("#column_3").animate({width:calc_column_width},ani_width,function(){$("#column_3").animate({opacity:1},ani_opacity).show('slow');});$("#column_4").animate({width:calc_column_width},ani_width,function(){$("#column_4").animate({opacity:1},ani_opacity).show('slow');});$("#column_5").animate({width:calc_column_width},ani_width,function(){$("#column_5").animate({opacity:1},ani_opacity).show('slow');});$("#column_6").animate({width:calc_column_width},ani_width,function(){$("#column_6").animate({opacity:1},ani_opacity).show('slow');});});}else if(columns==7){$("#column_1").animate({width:calc_column_width},ani_width);$("#column_2").animate({width:calc_column_width},ani_width,function(){$("#column_2").animate({opacity:1},ani_opacity).show('slow');});$("#column_3").animate({width:calc_column_width},ani_width,function(){$("#column_3").animate({opacity:1},ani_opacity).show('slow');});$("#column_4").animate({width:calc_column_width},ani_width,function(){$("#column_4").animate({opacity:1},ani_opacity).show('slow');});$("#column_5").animate({width:calc_column_width},ani_width,function(){$("#column_5").animate({opacity:1},ani_opacity).show('slow');});$("#column_6").animate({width:calc_column_width},ani_width,function(){$("#column_6").animate({opacity:1},ani_opacity).show('slow');});$("#column_7").animate({width:calc_column_width},ani_width,function(){$("#column_7").animate({opacity:1},ani_opacity).show('slow');});}else{$("#column_5").animate({opacity:0},ani_opacity);$("#column_6").animate({opacity:0},ani_opacity);$("#column_7").animate({opacity:0},ani_opacity);$("#column_2").animate({opacity:1},ani_opacity).show('slow');$("#column_3").animate({opacity:1},ani_opacity).show('slow');$("#column_4").animate({opacity:1},ani_opacity).show('slow');$("#column_1").animate({width:calc_column_width},ani_width);$("#column_2").animate({width:calc_column_width},ani_width);$("#column_3").animate({width:calc_column_width},ani_width);$("#column_4").animate({width:calc_column_width},ani_width);}
$("#ajax_working").animate({opacity:1},1000).show();$.ajax({url:'ajax/AJ_save_num_col.php',data:'columns='+columns,type:'POST',datatype:'html',success:function(results){$('#ajax_working').animate({opacity:0},1000).hide(1000);}});});$('.options_rss').click(function(){var feeds=$(this).val();$("#ajax_working").animate({opacity:1},1000).show();$.ajax({url:'ajax/AJ_save_num_rss.php',data:'feeds='+feeds,type:'POST',datatype:'html',success:function(results){$('#ajax_working').animate({opacity:0},1000).hide(1000);}});});$('#opt_info_save').click(function(){var fname=$('#opt_info_fname').val();var lname=$('#opt_info_lname').val();var email=$('#opt_info_email').val();var pass=$('#opt_info_pass').val();var passconfirm=$('#opt_info_passconfirm').val();$("#ajax_working").animate({opacity:1},1000).show();$.ajax({url:'ajax/AJ_save_user_info.php',data:'fname='+fname+'&lname='+lname+'&email='+email+'&pass='+pass+'&passconfirm='+passconfirm,type:'POST',datatype:'html',success:function(results){if(results=="not logged in"){$('#popup_overlay').show();$('#popup_overlay_message_area').html("<div class='error_box'><p>Sorry, You are not logged in.  <a href='"+URL_PATH+"'>Please log in</a>.</p></div>");}else if(results=="passwords do not match error"){$('#opt_info_message_area').html("<div class='error_box'>Sorry, your passwords do not match.</div>");}else if(results=="error"){$('#opt_info_message_area').html("<div class='error_box'>Sorry, there was a problem saving your information.  Please login again.</div>");}else{$('#ajax_working').animate({opacity:0},1000).hide(1000);$('#header_user_name').html(fname+" "+lname+"'s Site Squirrel");$('#opt_info_message_area').html("<div class='message_box animate_hide'>Your information has been saved.</div>");hide_animated_hide_div();}}});});$('.pg_bg_type').click(function(){var bg_type=$('input[name="pg_bg_type"]:checked').val();if(bg_type=="color"){$('#pg_bg_color_wrap').stop().animate({opacity:0},0).show().animate({opacity:1},500);$('#pg_bg_image_wrap').hide();}else{$('#pg_bg_image_wrap').stop().animate({opacity:0},0).show().animate({opacity:1},500);$('#pg_bg_color_wrap').hide();}
$.ajax({url:'ajax/AJ_save_bg_type.php',data:'bg_type='+bg_type,type:'POST',datatype:'html',success:function(results){if(results=="not logged in"){$('#popup_overlay').show();$('#popup_overlay_message_area').html("<div class='error_box'><p>Sorry, You are not logged in.  <a href='"+URL_PATH+"'>Please log in</a>.</p></div>");}else if(results=="error"){$('#opt_bg_message_area').html("<div class='error_box'>Sorry, there was a problem saving your information.  Please login again.</div>");}else{$('#ajax_working').animate({opacity:0},1000).hide(1000);if(bg_type=="color"){var rgb_current_bg_color=$('#page_bg_color').css('background-color');var hex_current_bg_color=rgb2hex(rgb_current_bg_color);var current_bg_color=hex_current_bg_color;$('body').css('background-image','url(0)');$('body').css('background-color',current_bg_color);}else{var current_image_bg='page_backgrounds/full_size/'+$('.pg_bg_image.pg_bg_image_sel').attr('data-image-name');if((current_image_bg=="")||(current_image_bg=="page_backgrounds/full_size/undefined")){var current_image_bg=$('#pg_bg_image_custom').val();}
$('body').css('background-image','url('+current_image_bg+')');}
$('#opt_bg_message_area').html("<div class='message_box animate_hide'>Your information has been saved.</div>");hide_animated_hide_div();}}});});$('#apply_bg_color').click(function(){var rgb_current_bg_color=$('#page_bg_color').css('background-color');var hex_current_bg_color=rgb2hex(rgb_current_bg_color);var current_bg_color=hex_current_bg_color;$.ajax({url:'ajax/AJ_save_bg_color.php',data:'bg_color='+current_bg_color,type:'POST',datatype:'html',success:function(results){if(results=="not logged in"){$('#popup_overlay').show();$('#popup_overlay_message_area').html("<div class='error_box'><p>Sorry, You are not logged in.  <a href='"+URL_PATH+"'>Please log in</a>.</p></div>");}else if(results=="error"){$('#opt_bg_message_area').html("<div class='error_box'>Sorry, there was a problem saving your information.  Please login again.</div>");}else{$('#ajax_working').animate({opacity:0},1000).hide(1000);$('body').css('background-image','url(0)');$('body').css('background-color',current_bg_color);$('#opt_bg_message_area').html("<div class='message_box animate_hide'>Your information has been saved.</div>");hide_animated_hide_div();}}});});$('.pg_bg_image').click(function(){var background=$(this).attr('data-image-name');var tile=$(this).attr('data-image-tile');$('.pg_bg_image').removeClass('pg_bg_image_sel');$(this).addClass('pg_bg_image_sel');$('#pg_bg_image_custom').val('');$.ajax({url:'ajax/AJ_save_bg_image_info.php',data:'background='+background+'&tile='+tile,type:'POST',datatype:'html',success:function(results){if(results=="not logged in"){$('#popup_overlay').show();$('#popup_overlay_message_area').html("<div class='error_box'><p>Sorry, You are not logged in.  <a href='"+URL_PATH+"'>Please log in</a>.</p></div>");}else if(results=="error"){$('#opt_bg_message_area').html("<div class='error_box'>Sorry, there was a problem saving your information.  Please login again.</div>");}else{$('#ajax_working').animate({opacity:0},1000).hide(1000);if(tile=="no"){var this_tile="no-repeat";}else{var this_tile="repeat";}
$('body').css('background-image','url(page_backgrounds/full_size/'+background+')');$('body').css('background-repeat',this_tile);$('#opt_bg_message_area').html("<div class='message_box animate_hide'>Your information has been saved.</div>");hide_animated_hide_div();}}});});$('#pg_bg_img_cust_save').click(function(){var url=$('#pg_bg_image_custom').val();if($("#pg_bg_img_cust_tile").is(':checked')){var tile="yes";}else{var tile="no";}
$('.pg_bg_image').removeClass('pg_bg_image_sel');$.ajax({url:'ajax/AJ_save_bg_image_custom_info.php',data:'background='+url+'&tile='+tile,type:'POST',datatype:'html',success:function(results){if(results=="not logged in"){$('#popup_overlay').show();$('#popup_overlay_message_area').html("<div class='error_box'><p>Sorry, You are not logged in.  <a href='"+URL_PATH+"'>Please log in</a>.</p></div>");}else if(results=="error"){$('#opt_bg_message_area').html("<div class='error_box'>Sorry, there was a problem saving your information.  Please login again.</div>");}else{$('#ajax_working').animate({opacity:0},1000).hide(1000);if(tile=="no"){var this_tile="no-repeat";}else{var this_tile="repeat";}
$('body').css('background-image','url('+url+')');$('body').css('background-repeat',this_tile);$('#opt_bg_message_area').html("<div class='message_box animate_hide'>Your information has been saved.</div>");hide_animated_hide_div();}}});});$('.star').live("click",function(){var current_star=$(this).attr('id');var the_star=$(this);var current_link_id=$(this).parent().attr('data-linkid');$('#ajax_working').animate({opacity:1},10).show();$.ajax({url:'ajax/AJ_update_link_star.php',data:'current_star='+current_star+'&link_id='+current_link_id,type:'POST',datatype:'html',success:function(results){if(results=="not logged in"){$('#popup_overlay').show();$('#popup_overlay_message_area').html("<div class='error_box'><p>Sorry, You are not logged in.  <a href='"+URL_PATH+"'>Please log in</a>.</p></div>");}else if(results=="error"){$('#opt_bg_message_area').html("<div class='error_box'>Sorry, there was a problem saving your information.  Please login again.</div>");}else{$('#ajax_working').animate({opacity:0},1000).hide(1000);the_star.replaceWith(results);}}});});$('.drawer_button').live("click",function(){var this_action_drawer=$(this).parent().parent();if(this_action_drawer.hasClass('link_action_wrap_close')){this_action_drawer.removeClass('link_action_wrap_close');this_action_drawer.addClass('link_action_wrap_open');}else{this_action_drawer.removeClass('link_action_wrap_open');this_action_drawer.addClass('link_action_wrap_close');}});$('#sign_up_display').click(function(){$('#create_account').slideToggle();$('#login_box').slideUp('slow',function(){$('#login_box').hide();});$('#forgot_password_wrapper').slideUp('slow',function(){$('#forgot_password_wrapper').hide();});return false;});$('#forgot_password_link').click(function(){$('#forgot_password_wrapper').slideToggle();$('#login_box').slideUp('slow',function(){$('#login_box').hide();});$('#create_account').slideUp('slow',function(){$('#create_account').hide();});return false;});$('#createAccountCancel').click(function(){$('#login_box').slideToggle();$('#create_account').slideUp('slow',function(){$('#create_account').hide();});return false;});$('#forgotPassCancel').click(function(){$('#login_box').slideToggle();$('#forgot_password_wrapper').slideUp('slow',function(){$('#forgot_password_wrapper').hide();});return false;});$('#popup_overlay').hide();});function newWindow(url,height,width){nameW='_blank'
if(navigator.appVersion.indexOf('4')!=-1){xTop=screen.width/2-(width/2);yTop=screen.height/2-(height/2);window.open(url,nameW,'height='+height+',width='+width+',scrollbars=0,resizable=1,menubar=0,toolbar=0,status=0,location=0,directories=0,left='+xTop+',top='+yTop+'');}else{window.open(url,nameW,'height='+height+',width='+width+',scrollbars=0,resizable=1,menubar=0,toolbar=0,status=0,location=0,directories=0,left=150,top=200');}}

