var content1 ;
var content1container1 ;
var position1 = 1;
var rot_position1 = 0;
var rot_timer1;
var maxY_2,wd_2, maxX_2, ready_2, slideDur_2=1000, destX_2=0, destY_2=0, distY_2, distX_2, per_2, sliding_2, slideStart_2, aniTimer_2, startX_2, startY_2, xcoordinate_2, ycoordinate_2,url_path_rotation_2;
var totProject_2;
var capcity_2 = 3;
var imgScroll1_2 = new Image();imgScroll1_2.src = "http://www.demowebserver.com/irg/images/blue-next-arrow.jpg";
var imgScroll2_2 = new Image();imgScroll2_2.src = "http://www.demowebserver.com/irg/images/D_blue-next-arrow.jpg";
var imgScroll3_2 = new Image();imgScroll3_2.src = "http://www.demowebserver.com/irg/images/blue-previous-arrow.jpg";
var imgScroll4_2 = new Image();imgScroll4_2.src = "http://www.demowebserver.com/irg/images/D_blue-previous-arrow.jpg";
function load1(cntId,rot_value,url_path,num)
{
	//alert('test - '+num);
	var tabname = document.getElementById("table-content1");
	
	var tdcount = tabname.getElementsByTagName("td");
	//alert('tdcount - '+tdcount);
	var zval = tdcount.length / 4;
	
	var tdwidth = tdcount.length*138+"px";//lnsize
	var showwidth =	document.getElementById('table-content1').clientWidth;
	showwidth = tdwidth;
	document.getElementById('table-content1').style.width = showwidth;
	totProject_2 = num - 1;

	position1 = 1;
	url_path_rotation_2 = url_path;
	if(!document.getElementById)
		return;

	content1 = document.getElementById("content1");
	content1container1 = document.getElementById("content1-container1"); 

	content1.visibility="hidden";
	content1.style.top=0;
	content1.style.left=0;
	xcoordinate_2=0;
	ycoordinate_2=0;
	maxY_2=(content1.offsetHeight-content1container1.offsetHeight>0)?content1.offsetHeight-content1container1.offsetHeight:0;
	wd_2=cntId?document.getElementById(cntId).offsetWidth:content1.offsetWidth;
	maxX_2=(wd_2-content1container1.offsetWidth>0)?wd_2-content1container1.offsetWidth:0;
	content1.style.visibility="visible";
	ready_2=true;

	//document.getElementById("slide-links").style.visibility="visible";
	document.getElementById("slideprevious1").style.visibility="visible";
	document.getElementById("slidenext1").style.visibility="visible";
	
	rot_timer1 = setInterval("do_rotation1()",rot_value);
	disableAnchor1(document.getElementById("slidenext1"),true);
	document.getElementById("image_next1").src = url_path_rotation_2 + "D_blue-next-arrow.jpg";
	disableAnchor1(document.getElementById("slideprevious1"),true);
	document.getElementById("image_previous1").src = url_path_rotation_2 + "D_blue-previous-arrow.jpg";
	
	//alert(num)
 }

function glideTo1(MstartX_2, MstartY_2)
{
	content1 = document.getElementById("content1"); 
	content1container1 = document.getElementById("content1-container1");
	startX_2 = parseInt(content1.style.left);
	if(startX_2 == "")
	{
		startX_2 = 0;
	}
	startY_2 = parseInt(content1.style.top);
	destX_2 = -Math.max(Math.min(MstartX_2, maxX_2), 0);
	destY_2 = -Math.max(Math.min(MstartY_2, maxY_2), 0);
	distY_2 = destY_2 - startY_2;
	distX_2 =  destX_2 - startX_2;
	per_2 = Math.PI/(2 * slideDur_2);
	sliding_2 = false;
	slideStart_2 = (new Date()).getTime();
	aniTimer_2 = setInterval("doSlide1()",10);
	on_slide_start_2(startX_2, startY_2);
  }



function doSlide1() 
{
	var elapsed = (new Date()).getTime() - slideStart_2;
	//alert(elapsed + ':' + slideStart_2);
	if (elapsed < slideDur_2)
	{
		//alert("test1");
		var x = startX_2 + distX_2 * Math.sin(per_2*elapsed);
		var y = startY_2 + distY_2 * Math.sin(per_2*elapsed);
		shiftTo1(x, y);
		on_slide_2(x, y);
	} 
	else
	{	// if time's up
		//alert("test2");
		clearInterval(aniTimer_2);
		sliding_2 = false;
		shiftTo1(destX_2, destY_2);
		//content1 = null;
		on_slide_end_2(destX_2, destY_2);
	}
}

function shiftTo1(x,y)
{
	 //alert(x + ':' + y);
	 if(typeof(x) == "number")
	 {
		content1.style.left=x+"px";
		content1.style.top=y+"px";
	 }
}

on_slide_start_2 = function() {}
on_slide_2 = function() {}
on_slide_end_2 = function() {}


function next_previous1(str,img_url)
{

	clearInterval(rot_timer1);
	
	if(str == "next")
	{
		
		if(document.getElementById("slideprevious1").href == "")
		{
				disableAnchor1(document.getElementById("slideprevious1"),false);
				document.getElementById("image_previous1").src = url_path_rotation_2 + "blue-previous-arrow.jpg";
//			alert ("Next Condition - Clicked position1 value : "+position1);
		}		
		if(position1 < totProject_2)
		{
			position1++;
			glideTo1(eval(position1-1) * 138,0);//lnsize
			disableAnchor1(document.getElementById("slidenext1"),false);
			document.getElementById("image_next1").src = url_path_rotation_2 + "D_blue-next-arrow.jpg";
//			alert ("Next Condition - Clicked position1 value : "+position1);
		}
		if(position1 == totProject_2)
		{
			disableAnchor1(document.getElementById("slidenext1"),true);
			document.getElementById("image_next1").src = url_path_rotation_2 + "D_blue-next-arrow.jpg";
//			alert ("Next Condition - Clicked position1 value : "+position1);
		}
		
	}

	if(str == "previous")
	{
		//alert("test");
		
		if(document.getElementById("slidenext1").href == "")
		{
			disableAnchor1(document.getElementById("slidenext1"),false);
			document.getElementById("image_next1").src = url_path_rotation_2 + "blue-next-arrow.jpg";
//			alert ("Next Condition - Clicked position1 value : "+position1);
		}
		if(position1 > 1)
		{
			position1--;
			glideTo1(eval(position1-1) * 138,0);//lnsize
			disableAnchor1(document.getElementById("slideprevious1"),false);
			document.getElementById("image_previous1").src = url_path_rotation_2 + "blue-previous-arrow.jpg";
//			alert ("Next Condition - Clicked position1 value : "+position1);
		}
		if(position1 == 1)
		{
			disableAnchor1(document.getElementById("slideprevious1"),true);
			document.getElementById("image_previous1").src = url_path_rotation_2 + "D_blue-previous-arrow.jpg";
//			alert ("Next Condition - Clicked position1 value : "+position1);
		}
	}
	
	//rot_timer1 = setInterval("do_rotation1()",'5000');
}

function do_rotation1()
{
	//alert ("Show position1 :"+position1+" - start rotation");
	//alert ("totProject_2 :"+totProject_2+" - start rotation");
	if(position1 < totProject_2)
	{
		position1++;
		glideTo1(eval(position1-1) * 138,0);//lnsize
		disableAnchor1(document.getElementById("slideprevious1"),false);
		document.getElementById("image_previous1").src = url_path_rotation_2 + "blue-previous-arrow.jpg";
		disableAnchor1(document.getElementById("slidenext1"),false);
		document.getElementById("image_next1").src = url_path_rotation_2 + "blue-next-arrow.jpg";
	}
	else
	{
		position1 = 1;
		glideTo1(eval(position1-1) * 138,0);//lnsize
		disableAnchor1(document.getElementById("slideprevious1"),false);
		document.getElementById("image_previous1").src = url_path_rotation_2 + "D_blue-previous-arrow.jpg";
		disableAnchor1(document.getElementById("slidenext1"),false);
		document.getElementById("image_next1").src = url_path_rotation_2 + "D_blue-next-arrow.jpg";
	}

}

function disableAnchor1(obj, disable)
{
	if(disable)
	{
		var href = obj.getAttribute("href");
		obj.removeAttribute('href');
	}
	else
	{
		if(obj.id == "slidenext1")
		{
			obj.setAttribute('href',"javascript:next_previous1('next','" + url_path_rotation_2 + "')");
		}
		if(obj.id == "slideprevious1")
		{
			obj.setAttribute('href',"javascript:next_previous1('previous','" + url_path_rotation_2 + "')");
		}
	}
}

//script for makaan popup tab starts here
/*
function showhide (id) {
	var d = document.getElementById(id);
		for (var i=1; i<=2; i++) {
			if (document.getElementById('reporttab0'+i)) {
				document.getElementById('reporttab0'+i).style.display='none';
				document.getElementById('reporttab0'+i+'img').src="/images/new/product-lp/reporttab0"+i+"-off.gif";
			}
		}
	if (d) {
			document.getElementById(d.id+'img').src="/images/new/product-lp/"+d.id+"-on.gif";
			d.style.display='block';
		}
}
*/

//var i=1;
//var j2=1;
//var intervalID_2;
//var selval_2 = 1;
//
//function slideshow1 (id){
//
//	//document.getElementById('slidermenu').style.display='block';
////	var btnaction = document.getElementById("pause").innerHTML;
//
//	for(var i=1; i<=3; i++) {
//		if (document.getElementById('slider'+i)){
//			//document.getElementById('slider'+i).style.display='none';
//			//document.getElementById('showlink'+i).className='showlink';
//		}
//	}
//
//	//document.getElementById('slider'+selval).style.display='block';
//	//document.getElementById('showlink'+selval).className='showactive';
//
//	if (id=="startslide1"){
//		//alert ("Main if condition : "+id);
//		intervalID_2 = setInterval(startslide1fn_2, 5000);
//	}
//
//	else if (id!="startslide1" && id!="pause" && id!="play" && id!="next" && id!="prev"){
//		//alert ("First Else if condition : "+id);
//		selval_2=id;
//		for(var i=1; i<=2; i++) {
//			if (document.getElementById('slider'+i)){
//				//document.getElementById('slider'+i).style.display='none';
//				//document.getElementById('showlink'+i).className='showlink';
//			}
//		}
//		//document.getElementById("slider"+id).style.display='block';
//		//document.getElementById('showlink'+id).className='showactive';
//		clearInterval(intervalID_2)
////		document.getElementById("pause").innerHTML='play';
////		alert ("Else if Condition - Show value of i : "+i+" - Show value of id : "+id);
//
////		document.slidevalfrm.slideval.value="slider"+id;
//	}
//
//
//
//}
//
//function startslide1fn_2 (){
//
//	for(var i=1; i<=3; i++) {//4
//		if (document.getElementById('slider'+i)){
//			//document.getElementById('slider'+i).style.display='none';
//			//document.getElementById('showlink'+i).className='showlink';
//		}
//	}
//
//	if (j2>=2) {
//		//document.getElementById('slider1').style.display='block';
//		//document.getElementById('showlink1').className='showactive';
////		alert ("If condition where "+j+" greater than 3");
//		selval_2='1';
//		j2=1;
//	}
//
//	else {
//		j2++;
//		//document.getElementById('slider'+j).style.display='block';
//		//document.getElementById('showlink'+j).className='showactive';
//		selval_2=j2;
////		alert ("Else Condition - Show value of j : "+j);
//	}
//
//}

