/***Light box functions****/
function createLightBoxRev(id,url,divElem,bodyId,tableType,DivWidth)
{
	//alert('in');
	divIdLight =  $('#'+id+'').attr("myId");
	if(document.getElementById(divElem) != null)
	{
		document.getElementById(divElem).style.display = 'block';
		
	}
	
	if(url != '')
	{	
		document.getElementById(divElem).innerHTML="<div align='center' style='margin-top:50px;'><img src='/images/loading.gif' ></div>";
		$("#"+divElem+"").load(""+url+"",{ 'id': [""+divIdLight+""],'case1':[tableType] });
	}
	
	//alert(document.getElementById(divElem).innerHTML);
	//alert(url);
	lightBoxRev(''+bodyId+'',''+divElem+'',DivWidth);
}
function lightBoxRev(bodyId,showId,customWidth)
{	
	divHeight = $("#"+showId+"").offset().top;
	model_img = document.createElement('img');
	model_img.setAttribute('src','/images/topbg.gif');
	myWidth = document.getElementById('theDoc').offsetWidth;
	myHeight = document.getElementById('theDoc').scrollHeight;
	model_img.setAttribute('width',myWidth);
	model_img.setAttribute('height',myHeight);
	
	//model_img.setAttribute('z-index',1100);
	model_img.style.top = 0;
	model_img.style.position = "absolute";
	
	model_img.style.opacity=0.6;
	model_img.style.zIndex=10;
	model_img.style.MozOpacity = '0.7';
	model_img.style.filter="alpha(opacity=60)";	
	tempHeight = screen.height/2;		

	//if(navigator.appVersion.match('MSIE 6.0'))
	//{
		$( "#"+showId+"" ).scrollFollow({
				//offset: divHeight
		});		
	//}

	document.body.appendChild(model_img);	
	myWidth = document.getElementById(bodyId).scrollWidth;	
	//alert(document.getElementById(showId).innerHTML);
	document.getElementById(showId).style.display = "block";
	tempWidth = screen.width-((myWidth*customWidth)/100);
	leftPos = tempWidth/2;	
	document.getElementById(showId).style.left = leftPos+"px";	
	//document.getElementById(showId).style.zIndex = 1000;
}

function closeLightBoxRev(id)
{
	
	document.body.removeChild(model_img);
	divClose = $("#"+id+"").attr("parentDiv");
	
	document.getElementById(divClose).innerHTML = "";
	document.getElementById(divClose).style.display = "none";
}

function setReview(par1)
{
	if($('#'+par1).is(":hidden"))
	{
		$('#'+par1).slideDown();
	}
	else
	{
		$('#'+par1).slideUp();
	}
}

function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6.
{
   var arVersion = navigator.appVersion.split("MSIE")
   var version = parseFloat(arVersion[1])
   if ((version >= 5.5) && (document.body.filters))
   {
      for(var i=0; i<document.images.length; i++)
      {
         var img = document.images[i]
         var imgName = img.src.toUpperCase()
         if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
         {
            var imgID = (img.id) ? "id='" + img.id + "' " : "";
            var imgName = (img.name) ? "name='" + img.name + "' " : "";
            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;
            var imgHeight = (img.height) ? img.height : 18;
            var imgWidth = (img.width) ? img.width : 18;
            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 = "<img " + imgID + imgName + imgClass + imgTitle
            + " style=\"" + "width:" + imgWidth + "px; height:" + imgHeight + "px;" + imgStyle + ";"
            + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
            + "(src=\'" + img.src + "\', sizingMethod='scale');\" border='0' src='/images/spacer.gif' height='" + imgHeight + "' width='" + imgWidth + "' />";
            img.outerHTML = strNewHTML;
            i = i-1;
         }
      }
   }
}
function getAttribute(obj, name)
{
    for (var i = 0; i < obj.attributes.length; i++) {
        if (name == obj.attributes[i].name) {
            return obj.attributes[i].value;
        }
    }
}


function shareDealFriends(id, tableType)
{
	if(Trim(id)!='' && id!='undefined' && Trim(tableType)!='' && tableType!='undefined')
	{
		window.location = "/deal-send-to-friend.php?id="+id+"&case1="+tableType;	
	}
}