$(document).ready(function () { $('.mainImg').each(function () { var dv = $(this).closest('.imgHover'); var spn = $(this).closest('span'); if ($(spn).css('display') == 'none') { $(spn).html($('.divBlankPic')[0].outerHTML); $(dv).find('.tpPicEdit').find('img').last().remove(); if ($(dv).find('.tpPicEdit').find('img').length > 1) { $(dv).find('.tpPicEdit').find('img').last().remove(); } $(dv).find('.tpPicEdit').find('img').attr('src', '../v5images/16/B/add.png'); $(dv).find('.tpPicEdit').find('img').attr('title', 'Add Picture'); $(spn).show(); } }); $('.mainFile').each(function () { var dv = $(this).closest('.imgHover'); var spn = $(this).closest('span'); if ($(spn).css('display') == 'none') { $(spn).html($('.divBlankFile')[0].outerHTML); $(dv).find('.tpPicEdit').find('img').last().remove(); $(dv).find('.tpPicEdit').find('img').attr('src', '../v5images/16/B/add.png'); $(dv).find('.tpPicEdit').find('img').attr('title', 'Add File'); $(spn).show(); } }); }); ///Picture Stuff function RemovePicture(n) { var cnf = confirm("Are you sure you want to remove this picture from this record?"); if (cnf) { var img = $(n).closest('.imgHover').find('.mainImg'); var dv = $(n).closest('.imgHover'); var inp = $(dv).find('input'); $(dv).find('span').html($('.divBlankPic')[0].outerHTML); $(dv).find('.tpPicEdit').find('img').last().remove(); if ($(dv).find('.tpPicEdit').find('img').length > 1) { $(dv).find('.tpPicEdit').find('img').last().remove(); } $(dv).find('.tpPicEdit').find('img').attr('src', '../v5images/16/B/add.png'); $(dv).find('.tpPicEdit').find('img').attr('title', 'Add Picture'); $(inp).val(''); $(img).remove(); } } function SetPicEditToolBar(spn) { //var dv = $(spn).closest('.imgHover'); var tb = $.find('.tpPicEdit[activated="yes"]'); var str = ''; str = $(tb).find('img').first().attr('src'); if (str.indexOf("add.png") > -1) { $(tb).find('img').attr('src', '../v5images/16/B/edit.png'); $(tb).find('img').attr('title', 'Edit Picture'); $(tb).append(''); } $(tb).attr('activated', 'no'); } ///File Stuff function RemoveFile(n) { var cnf = confirm("Are you sure you want to remove the file from this record?"); if (cnf) { var dv = $(n).closest('.imgHover'); var inp = $(dv).find('input'); $(dv).find('span').html($('.divBlankFile')[0].outerHTML); $(dv).find('.tpPicEdit').find('img').last().remove(); $(dv).find('.tpPicEdit').find('img').attr('src', '../v5images/16/B/add.png'); $(dv).find('.tpPicEdit').find('img').attr('title', 'Add File'); $(inp).val(''); } } function SetFileEditToolBar(spn) { //var dv = $(spn).closest('.imgHover'); var tb = $.find('.tpPicEdit[activated="yes"]'); var str = ''; str = $(tb).find('img').first().attr('src'); if (str.indexOf("add.png") > -1) { $(tb).find('img').attr('src', '../v5images/16/B/edit.png'); $(tb).find('img').attr('title', 'Edit File'); $(tb).append(''); } $(tb).attr('activated', 'no'); } $(function () { $('.imgHover').hover(function () { $(this).find('.mainImg').fadeTo(200, 0.55).end().children('.hover').show(); }, function () { $(this).find('.mainImg').fadeTo(200, 1).end().children('.hover').hide(); }); });