// JavaScript Document
var objPos
var objL
var objT
function ObjectPosition(obj) {
      var curleft = 0;
      var curtop = 0;
      if (obj.offsetParent) {
            do {
                  curleft += obj.offsetLeft;
                  curtop += obj.offsetTop;
            } while (obj = obj.offsetParent);
      }
	   return [curleft,curtop];
}
function PopInfoCty(obj,id){
	//alert(obj +' | '+ id)
	var shwdiv = 'info'+id
	objPos = ObjectPosition(document.getElementById(obj))
	//alert(objPos[0] +' | '+ objPos[1])
	if (objPos[0] > 800){ 
		objPos[0] = objPos[0] - 100
	}
	objL = objPos[0] - 80 +'px'
	objT = objPos[1] + 15 +'px'
	
	 
	document.getElementById(shwdiv).style.left = objL;
	document.getElementById(shwdiv).style.top = objT;
	$('#info'+id+'').show();
}
function closeInfo(id){
	$('#info'+id+'').hide();
	
}
function openInfo(id){
	var imgSrc;
	var imgVal;
	var divShw = id;
	var divInfo
	var divInfoH
	var reID = divShw.replace('pic','');
	divShw = divShw.replace('pic','');
	divInfo = 'desc'+divShw;
	divInfoH = 'desch'+divShw;
	divtxt = 'txt'+divShw;
	divShw = 'pkInf'+divShw;
	imgSrc = $('#'+id+'').attr("src");
	imgVal = imgSrc.indexOf("Plus");
	if (imgVal != -1){
		$('#'+id+'').attr("src","/images/Minus.jpg");
		$('#'+divInfo+'').hide();
		$('#'+divInfoH+'').show();
		$('#'+divShw+'').show();
		if(document.getElementById(divtxt) != null){
			$('#'+divtxt+'').html('Hide details');
		}
		$.ajax({
		url: "/GET_PackRelatedInfo.aspx", 
		//data: {PackID: ""+reID+""}, //stringQuery, if is GET
		data: {'PackID': ''+ reID +''},
		type: "POST",
		success: function(html){
				$('#rel'+reID+'').html(html);
				$('#butt'+reID+'').show();
  		},
		error: function (xhr, desc, exceptionobj) {
			$('#rel'+reID+'').html(xhr.responseText);
    		alert(xhr.responseText +' = error');
  		}
	});
		/*$.get("/GET_PackRelatedInfo.aspx", { PackID: ""+reID+""},
			function(data){
			if (data == "false"){
				$('#rel'+reID+'').html("<div id='message'></div>");
				return false;
			}
			else{
				$('#rel'+reID+'').html(data);
				init()
				$('#butt'+reID+'').show();
			}
		});*/
	}
	else{
		$('#'+id+'').attr("src","/images/Plus.jpg");
		$('#'+divInfo+'').show()
		$('#'+divInfoH+'').hide();
		$('#'+divShw+'').hide();
		if(document.getElementById(divtxt) != null){
			$('#'+divtxt+'').html('More details');
		}
		$('#rel'+reID+'').html('');
		$('#butt'+reID+'').hide();
	}
}


function changeClass(chkid){
	alert(chkid)
	var check = chkid.replace('false','');
	alert(check)

}

