/* 
COPYRIGHT &copy; 2010 Flaunt Books & Skooks Designs. ALL RIGHTS RESERVED.  THIS FILE AND ASSOCIATIVE FILES ARE DIGITALLY TRACKED.  
DISTRIBUTION, MODIFICATION AND CREATING DERIVITIVE WORKS IN ANY FORM IS STRICTLY PROHIBITED. 
*/



function imagevote( id )
{
  jQuery('#votediv'+id)
    .width(jQuery('#votediv'+id).width())
    .height(jQuery('#votediv'+id).height());
  //jQuery('#votebtn'+id).fadeOut(250);
  //alert('#votebtn'+id);
  jQuery('#votebtn'+id).hide();

  jQuery.getJSON( imagevote_url + '?imagevote_id=' + id,
    function( data )
    {
      jQuery('#votecount'+id).html(data.votes);
      jQuery.get(imagevote_url+'?imagevote_top=1&n='+imagevote_n+'&m='+imagevote_m+'&s='+imagevote_s+'&e='+imagevote_e,
        function(data)
        {
          jQuery('.topvotetable').each(
            function()
            {
            this.innerHTML = data;
            }
          );
        }
      );
    }
  );
}
jQuery(window).load(function(){
        // weave your magic here.
//jQuery(document).ready( function(){
  jQuery("img").each(function(i) {
    var image_id = jQuery(this).attr('id');
    image_id = image_id.substr(3);
    if(image_id>0){
      var imgwidth = jQuery(this).width();
	  if(imgwidth <5){ imagewidth = 900; }
      var imgheight = jQuery(this).height();
      var imghspace = jQuery(this).attr('hspace');
      var imgvspace = jQuery(this).attr('vspace');
      var alignment = jQuery(this).attr('align');
      var imgclass = jQuery(this).attr('class');
      jQuery(this).attr({align:"", hspace:"", vspace:""});
      jQuery('#image-container'+image_id)
        .addClass( imgclass )
        .css('float', alignment)
        .width(imgwidth+10)
        //.css({"margin-top": imgvspace, "margin-left": imghspace, "margin-right": imghspace});
		//.css({"margin-top": imgvspace});
    }
  });
} );
