/*
 Loading Progress Meter Bar for Opera/firefox/Chrome/Safari/IE /Android Browser

 ------------------------------------------------------------------------------
 Copyright (c) 2012 A Man Walking Company ( unregested) email: kwangkia@gmail.com
  Sole-proprietorship : Toh Jiunn Kwang
 Info/Docs http://www.luck99.info
 If you are copying or using my script please donate to my website 1 USD only.

  Purchased License  : Ban Leong Bros Pte LTD
 Purchaser                 : Toh Jiunn Kwang
 ------------------------------------------------------------------------------
*/

var countPic = new Number(0);
var totalPic = new Number(0);
var loadingsquare = new Number(0);
// all calculation doucment.get element has to be in function because all it won't get any value when loading only after all source code loaded the
// first picture will fire picturecount thus will have value of image.length

	function picturecount()
	{
		countPic++;
		
		if(document.getElementsByTagName("img").length) // to prevent hang due to early loading state find no value
			{	
			totalPic = document.getElementsByTagName("img").length; 
			}

		if(document.body.clientWidth)
			{
			loadingsquare = document.body.clientWidth/totalPic/2;
			}

		if(document.all.howmany)
			{
			document.all.howmany.innerHTML=countPic + " of " + totalPic + " or "+ Math.round(countPic/totalPic*100) + "%";
			}
		if(document.all.loadingbar)
			{
			document.all.loadingbar.width=countPic *loadingsquare;
			}
				
	}
	
	// this script has to be after the head tag.


