var preloaded = new Array(); function preload_images() { for (var i = 0; i < arguments.length; i++){ preloaded[i] = document.createElement('img'); preloaded[i].setAttribute('src',arguments[i]); }; }; //bind click events to any multiselect boxes in page $(function(){ $('.multiSelect_available, .multiSelect_selected').click(function() { multiId = $(this).attr('id').substr(0,$(this).attr('id').lastIndexOf('_')); type = $(this).attr('id').substr(multiId.length+1); option = $(this).find('option:eq(' + $(this)[0].selectedIndex + ')'); switch(type) { case "available": $('#'+multiId+'_selected').append(option); break; default: $('#'+multiId+'_available').append(option); }; sel = Array(); $('#'+multiId+'_selected option').each(function(){ sel.push($(this).val()) }) $('#'+multiId).val(sel); }); }) //the following is used by fck allot for setting attributes and stuff function SetAttribute(element, attName, attValue){ if (attValue == null || attValue.length == 0) element.removeAttribute(attName, 0); // 0 : Case Insensitive else element.setAttribute(attName, attValue, 0); // 0 : Case Insensitive } //position dialog boxes function position_dialog(dialog) { if (window.top != window) { if(dialog.data) { //dialog is an event if function was bound - if so animate to position $(document).scrollTop() dialog = dialog.data.dialog $('#'+dialog).stop().animate({ top: $(document).scrollTop() + (($(window).height()/2)-($('#'+dialog).height()/2)), left: (($(window).width()/2) - ($('#'+dialog).width()/2))+ "px" }); } else { //don't animate $('#'+dialog).stop().css({ top: $(document).scrollTop() + (($(window).height()/2)-($('#'+dialog).height()/2)), left: (($(window).width()/2) - ($('#'+dialog).width()/2)) + "px" }); } }else{ if(dialog.data) { //dialog is an event if function was bound - if so animate to position $(document).scrollTop() dialog = dialog.data.dialog $('#'+dialog).stop().animate({ top: $(document).scrollTop() + (($(window).height()/2)-($(document).height()/2)), left: (($(window).width()/2) - ($(document).width()/2))+ "px" }); } else { //don't animate $('#'+dialog).stop().css({ top: $(document).scrollTop() + (($(window).height()/2)-($(document).height()/2)), left: (($(window).width()/2) - ($(document).width()/2)) + "px" }); } } }