// JavaScript Document
//big Image/video of Thumbs in largePhoto window
function bigImage(pageId,id,userId,entId,tabId,albumEntityTypeId,albumId,thumbNo)
{

	//alert("t= "+albumEntityTypeId);
	//alert("Id= "+albumId);
	//alert("tab= "+tabId);
	var xmlhttp=false; 
	try {
			xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); 
	} 
	catch (e)
	{
		try {
				xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
		} catch (E) {
			xmlhttp = false;
					}
	}
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
					xmlhttp = new XMLHttpRequest(); 
	 }
	 if(tabId == "photo")
	 {
		var file = "bigImageThumb.php?pageId="+pageId+"&id="+id+"&thumbNo="+thumbNo+"&userId="+userId+"&albumEntityTypeId="+albumEntityTypeId+"&albumId="+albumId;  
		//window.open(file);
	 }
	else if(tabId == "video")
	{
		var file = "bigVideoThumb.php?pageId="+pageId+"&id="+id+"&thumbNo="+thumbNo+"&userId="+userId+"&albumEntityTypeId="+albumEntityTypeId+"&albumId="+albumId;  
		//alert(file);
	}
	//window.open(file);
	xmlhttp.open('GET', file, true); 
	xmlhttp.onreadystatechange=function() {
	   if (xmlhttp.readyState==4) 
	   { 
	  	 var imageContent3 = xmlhttp.responseText; 
		 if( imageContent3 ){ 
		 //alert(document.getElementById('bigThumb'));
		//alert(imageContent3);
		var imageArr =  imageContent3.split("||");
		var imageArr0 = imageArr[0];
		var imageArr1 = imageArr[1];
		var imageArr2 = imageArr[2];
		var imageArr3 = imageArr[3];
		var imageArr4 = imageArr[4];
		var imageArr5 = imageArr[5];
		var imageArr6 = imageArr[6];
		var imageArr7 = imageArr[7];
		var imageArr8 = imageArr[8];
		var imageArr9 = imageArr[9];
		//alert("b4= "+document.getElementById('bigThumb').innerHTML);
		//alert("response= "+imageArr[0]);
		//For big Image
			
			document.getElementById('bigThumb').innerHTML = imageArr0; 
			//alert("after "+document.getElementById('bigThumb').innerHTML);
		/*	
			//For tag
			if(imageArr1)
			{
				document.getElementById('bigThumb2').innerHTML = "Tag : "+imageArr1;
				document.getElementById('tagDiv').style.display = "inline";
			}
			else
			{
				document.getElementById('bigThumb2').innerHTML = "";
				document.getElementById('tagDiv').style.display = "none";	
			}
			//For Rate
			if(imageArr2)
				document.getElementById('bigThumb3').innerHTML = "Rate : "+imageArr2; 
		*/		
			//For title
			document.getElementById('bigThumb4').innerHTML = imageArr3; 
			
			//For Html Content
			if(imageArr4)
			{
				document.getElementById('bigThumb5').innerHTML = imageArr4;
				document.getElementById('htmlContDiv').style.display = "inline";
			}
			else
			{
				document.getElementById('bigThumb5').innerHTML = "";
				document.getElementById('htmlContDiv').style.display = "none";	
			}
			//For Hidden Var
			document.getElementById('hiddenIds').innerHTML  = imageArr5; 
			
			//For Share Image
			document.getElementById('share').innerHTML  = "Shared : "+imageArr6; 
			
			//For image Views
			document.getElementById('imageViews').innerHTML  = "Views : "+imageArr7; 

			// applied by yash gohil on 14 june 2010..
			// to display large image link
			if(imageArr9 != "")
			{
				var MyImgPath = '../'+imageArr9;
				document.getElementById('disLargeImageLink').innerHTML = '<a href='+MyImgPath+' class="largeimgLink" target="_blank" title="Click here to see large image.">See Large Image</a>'; 
			}
			else
			{
				document.getElementById('disLargeImageLink').innerHTML = '<span class="largeimg">No Large Image</span>';
			}
			//============================================
			
		  }   //If readtState  	
		
	   } //Over If
	  } //Over Function
		xmlhttp.send(null); //Nullify the XMLHttpRequest
	
	var idVal = document.getElementById(id);
	idVal.className  = "thumbsBorder";
	var idArrVal = document.getElementsByName('idArr')[0].value;
	var idArrVal2 = idArrVal.split(",");

	for(i=0;i<idArrVal2.length;i++)
	{
		
		var arr = document.getElementById(idArrVal2[i]);
		if(arr != idVal)
			arr.className  = "thumbs";
	}
		return; 
}
//big Image of Thumbs in largePhoto window Over
function bigImageLast(pageId,id,userId,entId,tabId,thumbNo,albumTypeId,albumId)
{
	
	document.photo.lastThumbId.value=id;
	document.photo.pageId.value=pageId;
	document.photo.entId.value=entId;
	document.photo.curId2.value=0; //highlight current thumb border
	document.photo.editCont.value = "no";
	document.photo.submit();
}
//
function pre_next(controlVal,entId,user,pageId,tabId,albumEntityTypeId,albumId){
	
	/*alert("controlVal "+controlVal);
	alert("user "+user);
	alert("entId "+entId);
	alert("pageId "+pageId);
	alert("tabId "+tabId);
	alert("albumEntityTypeId "+albumEntityTypeId);
		alert("albumId "+albumId);*/
	var preval,recNo;
	var cId = document.getElementsByName("curId")[0].value;
	if(cId)
	{
		var curId2 = document.getElementsByName("curId")[0].value;
	}
	var idArrVal = document.getElementsByName('idArr')[0].value;
	var idArrVal2 = idArrVal.split(",");
	
	
	

		
    var xmlhttp=false; //Clear our fetching variable
	try {
			xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); //Try the first kind of active x object�
	} catch (e) {
                try {
                        xmlhttp = new ActiveXObject('Microsoft.XMLHTTP'); //Try the second kind of active x object
            } catch (E) {
                xmlhttp = false;
                        }
        }
        if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
                xmlhttp = new XMLHttpRequest(); //If we were able to get a working active x object, start an XMLHttpRequest
        }
		//var file = 'widgetPhoto.php';
		if(tabId == "photo")
		{
        	var file = 'widgetPhoto.php?controlVal='+controlVal+"&user="+user+"&preval="+curId2+"&recNo="+recNo+"&pageId="+pageId+"&entId="+entId+"&albumEntityTypeId="+albumEntityTypeId+"&albumId="+albumId; 
			//alert(file);
			//window.open(file);
		}
		else if(tabId == "video")
		{
        	var file = 'widgetVideo.php?controlVal='+controlVal+"&user="+user+"&preval="+curId2+"&recNo="+recNo+"&pageId="+pageId+"&entId="+entId+"&albumEntityTypeId="+albumEntityTypeId+"&albumId="+albumId; 
			//alert(file);
			//window.open(file);
		} 
		
		xmlhttp.open('GET', file , true); //Open the file through GET, and add the page we want to retrieve as a GET variable **
		xmlhttp.onreadystatechange=function() {
        if (xmlhttp.readyState==4) { //Check if it is ready to recieve data
        
                var content3 = xmlhttp.responseText; //The content data which has been retrieved ***
                if( content3 ){ //Make sure there is something in the content variable
				 //alert(content3);
					var imageArr =  content3.split("||");
					var imageArr0 = imageArr[0];
					var imageArr1 = imageArr[1];
					var imageArr2 = imageArr[2];
					var imageArr3 = imageArr[3];
					var imageArr4 = imageArr[4];
					var imageArr5 = imageArr[5];
					var imageArr6 = imageArr[6];
					var imageArr7 = imageArr[7];
					var imageArr8 = imageArr[8];	
					//If On Next click it is last thumb
					if(controlVal == "next")
					{
						if(idArrVal2[7] == curId2)
						{
							document.photo.lastThumbIdNext.value=imageArr8;
							document.photo.curId.value=imageArr8;
							document.photo.pageId.value=pageId;
							document.photo.entId.value=entId;
							document.photo.submit();	
						}	
					}
					//Over
					
						//If On pre click it is first thumb
	if(controlVal == "pre")
	{
		//alert("0 Val= "+idArrVal2[0]);
		//alert("curId2= "+curId2);
		if(idArrVal2[0] == curId2)
		{
			document.photo.preThumbId.value=imageArr8;
			document.photo.pageId.value=pageId;
			document.photo.entId.value=entId;
			document.photo.submit();	
		}	
	}
	//Over
					
					//For big Image
					document.getElementById('bigThumb').innerHTML = imageArr0; 
				/*	
					//For tag
					if(imageArr1)
					{
						document.getElementById('bigThumb2').innerHTML = "Tag : "+imageArr1;
						document.getElementById('tagDiv').style.display = "inline";
					}
					else
					{
						document.getElementById('bigThumb2').innerHTML = "";
						document.getElementById('tagDiv').style.display = "none";	
					}
					//For Rate
					if(imageArr2)
						document.getElementById('bigThumb3').innerHTML = "Rate : "+imageArr2; 
				*/	
					//For title
					document.getElementById('bigThumb4').innerHTML = imageArr3; 
					
					//For Html Content
					if(imageArr4)
					{
						document.getElementById('bigThumb5').innerHTML = imageArr4;
						document.getElementById('htmlContDiv').style.display = "inline";
					}
					else
					{
						document.getElementById('bigThumb5').innerHTML = "";
						document.getElementById('htmlContDiv').style.display = "none";	
					}
					//For Hidden Var
					document.getElementById('hiddenIds').innerHTML  = imageArr5; 
					
					//For Share Image
					document.getElementById('share').innerHTML  = "Shared : "+imageArr6; 
					
					//For Image Hits
					document.getElementById('imageViews').innerHTML  = "Views : "+imageArr7; 
					
					
					for(i=0;i<idArrVal2.length;i++)
					{
						
						var arr = document.getElementById(idArrVal2[i]);
						document.getElementById(idArrVal2[i]).className  = "thumbs"; 
						if(idArrVal2[i] == imageArr8)
						{
							document.getElementById(imageArr8).className  = "thumbsBorder"; 
						}
						
					}
					
					
		  }   //If Content3
        } //If Ready State
		} //state Change Function
        xmlhttp.send(null) //Nullify the XMLHttpRequest
return;
}



