// JavaScript Document
function IsImageOk(img) {
// During the onload event, IE correctly identifies
//any images that
// weren’t downloaded as not complete. Others should too. Gecko-based
// browsers act like NS4 in that they report this incorrectly.
if (!img.complete) {
return false;
}

// However, they do have two very useful properties:
//naturalWidth and
// naturalHeight. These give the true size of the image. If it failed
// to load, either of these should be zero.
if (typeof img.naturalWidth != "undefined" && img.naturalWidth== 0) {
return false;
}

// No other way of checking: assume it’s ok.
return true;
}
function pngfix(id){
var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])
		 
	if ((version >= 5.5) && (version < 7) && (document.body.filters)) 
	{
		// alert(version);
	  var img = document.getElementById(id)
	  //alert(img.height);
		 var imgID = (img.id) ? "id='" + img.id + "' " : ""
		 var imgClass = (img.className) ? "class='" + img.className + "' " : ""
		 var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
		 var imgStyle = "display:inline-block;" + img.style.cssText 
		 if (img.align == "left") imgStyle = "float:left;" + imgStyle
		 if (img.align == "right") imgStyle = "float:right;" + imgStyle
		 if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
		 var strNewHTML = "<span " + imgID + imgClass + imgTitle
		 + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
		 + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
		 + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
		 img.outerHTML = strNewHTML
	}

}
function checkImages() {
	//alert(document.getElementById('sweetdescc').width);                                         heavyImage = new Image(); 
	//heavyImage = new Image(); 
//	heavyImage.src = "images/sweet_description.png";
//	if(document.getElementById('sweetdescc').complete){
	  //alert('incarcat');
//	}
}

var picpag=4;
function jumppage(unde,ce){
    //alert(curpage+' '+pics2.length);
    if(pics2.length<6 && ce!='nu') return;
	if(unde=='back'){
			curpage=curpage-picpag;
		}
	if(unde=='next'){
			curpage=curpage+picpag;
		}
     //   alert(curpage+' '+pics2.length);
     //if(curpage==0)curpage=.length-picpag;
	if(curpage>=pics2.length-1)curpage=0;		
	if(curpage<0){
			curpage=pics2.length-(pics2.length%picpag);
             // alert(curpage+' '+pics2.length);
			if(curpage>=pics2.length-1)curpage=pics2.length-picpag;	
		}
	ge("container_slides").innerHTML='';
	for(i=1;i<=picpag;i++){
		///alert(i)
		if((curpage+i)<pics2.length)
		ge("container_slides").innerHTML+=drawelementdreapta(curpage+i);
	}	
}
function drawelementdreapta(id){
	var picid=id;
	//alert(picid);
	varsa='<table width="216" border="0" cellpadding="0" cellspacing="0" style="margin-bottom:10px;">  <tbody>    <tr>      <td width="216" height="120" align="center"  class="style1" ><img src="http://www.platinumsalessystems.com/uploads/community/CommunityPage/'+pics2[picid].medie+'" width="145" height="108"  style="cursor:pointer; margin:6px; " onmouseover="switchmare('+picid+')" onmouseout="switchmare(0)" alt="'+pics2[picid].titlu+'"  class="thumbsimage" /></td>    </tr>    <tr>      <td  align="center" class="style1" style="padding-top:9px">'+pics2[picid].titlu+'</td>    </tr>  </tbody></table>';	
   // alert (varsa);
    return varsa;
}
function switchmare(id){
	ge('main_image').src='http://www.platinumsalessystems.com/uploads/community/CommunityPage/'+pics2[id].mare;
}
function switchmic(id,cat){
	ge('main_image_'+cat).src='http://www.platinumsalessystems.com/uploads/community/CommunityPage/'+pics2[id].medie;
}
function goto(id){
	window.location.href=pics2[id].url;
}

