/**
*-Programe Developed by SIDS Solutionz Bangalore.
*-Created:02/jul/2010
*-Updated:02/jul/2010
*-Disclaimer: Company does not hold any responsibility for any change in the code other than SIDSSOL Employee's.
* General javascript functions
*/
function GetXmlHttpObject()
{
	var xmlHttp=null;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}
function emailcheck(emailID) 
{
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (!filter.test(emailID))
	{		
		return false;					
	}
	else
	{
		return true;
	}	
}
function Left(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function Top(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
	curtop += obj.y;
	return curtop;
}
/* function ajaxTem()
{

		var xmlHttp;		
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request");
			return;
		}
		url="";
		url=url+"&sid="+Math.random();
		xmlHttp.onreadystatechange=function()
		{
			if (xmlHttp.readyState==4)
			{
				//document.getElementById("").innerHTML=xmlHttp.responseText;
				
			}
		}			
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);	

} */
var featProdPlayIndexR=1;
var featuredProdTimerR=0;
function displayprodR(count)
{
	$(".divHomeFlashContent").css("display","none");
	$("#divHomeFlashContent_"+count).fadeIn(1000);
	var featuredCountR = document.getElementById("HFFeaturedCount1").value;
	if(featProdPlayIndexR==featuredCountR)
	{
		featProdPlayIndexR=1;
	}
	else
	{ 
		featProdPlayIndexR=featProdPlayIndexR+1;
	 } 
}
function playAdsR(count)
{
	if(featuredProdTimerR)
	{
		clearInterval(featuredProdTimerR);
	}
	displayprodR(featProdPlayIndexR);
	featuredProdTimerR=setInterval(function(){displayprodR(featProdPlayIndexR)},6000);
}
 


 var featProdPlayIndexS=1;
var featuredProdTimerS=0;
function displayprodS(count)
{
	$(".divHomeFlashContent1").css("display","none");
	$("#divHomeFlashContent1_"+count).fadeIn(1000);
	var featuredCountS = document.getElementById("HFFeaturedCount2").value;
	if(featProdPlayIndexS==featuredCountS)
	{
		featProdPlayIndexS=1;
	}
	else
	{ 
		featProdPlayIndexS=featProdPlayIndexS+1;
	 } 
}
function playAdsS(count)
{
	if(featuredProdTimerS)
	{
		clearInterval(featuredProdTimerS);
	}
	displayprodS(featProdPlayIndexS);
	featuredProdTimerS=setInterval(function(){displayprodS(featProdPlayIndexS)},6000);
} 
/* civil dialogue*/
var indexCD=1;
var TimerCD=0;
function displayCD(count)
{
	$(".divHomeFlashContent3").css("display","none");
	$("#divHomeFlashContent2_"+count).fadeIn(1000);
	var countCD = document.getElementById("HFFeaturedCount3").value;
	if(indexCD==countCD)
	{
		indexCD=1;
	}
	else
	{ 
		indexCD=indexCD+1;
	 } 
}
function playAdsCivil(count)
{
	if(TimerCD)
	{
		clearInterval(TimerCD);
	}
	displayCD(indexCD);
	TimerCD=setInterval(function(){displayCD(indexCD)},5000);
} 
/* BLC Ads */
var indexBlc=1;
var TimerBlc=0;
function displayBlc(count)
{
	$(".divFlashBlc").css("display","none");
	$("#divFlashBlc_"+count).fadeIn(1000);
	var countBlc = document.getElementById("HFBlcCount").value;
	if(indexBlc==countBlc)
	{
		indexBlc=1;
	}
	else
	{ 
		indexBlc=indexBlc+1;
	 } 
}
function playAdsBlc(count)
{
	if(TimerBlc)
	{
		clearInterval(TimerBlc);
	}
	displayBlc(indexBlc);
	TimerBlc=setInterval(function(){displayBlc(indexBlc)},5000);
} 
/* YUL Ads */
var indexYul=1;
var TimerYul=0;
function displayUrbanLeaders(count)
{
	$(".divFlashYul").css("display","none");
	$("#divFlashYul_"+count).fadeIn(1000);
	var countYul = document.getElementById("HFYulCount").value;
	if(indexYul==countYul)
	{
		indexYul=1;
	}
	else
	{ 
		indexYul=indexYul+1;
	 } 
}
function playAdsYul(count)
{
	if(TimerYul)
	{
		alert(TimerYul);
		clearInterval(TimerYul);
	}
	displayUrbanLeaders(indexYul);
	TimerYul=setInterval(function(){displayUrbanLeaders(indexYul)},5000);
} 
/* Citizen watch Ads */
var indexCitizen=1;
var TimerCitizen=0;
function displayYul(count)
{
	$(".divFlashCitizen").css("display","none");
	$("#divFlashCitizen_"+count).fadeIn(1000);
	var countCitizen = document.getElementById("HFCitizenCount").value;
	if(indexCitizen==countCitizen)
	{
		indexCitizen=1;
	}
	else
	{ 
		indexCitizen=indexCitizen+1;
	 } 
}
function playCitizen(count)
{
	if(TimerCitizen)
	{
		clearInterval(TimerCitizen);
	}
	displayYul(indexCitizen);
	TimerCitizen=setInterval(function(){displayYul(indexCitizen)},5000);
} 
/* Small Add banner*/
var indexSmall=1;
var TimerSmall=0;
function displaySmall(count)
{
	$(".divFlashSmallAdd").css("display","none");
	$("#divFlashSmallAdd_"+count).fadeIn(1000);
	var countSmall = document.getElementById("HFSmallCount").value;
	if(indexSmall==countSmall)
	{
		indexSmall=1;
	}
	else
	{ 
		indexSmall=indexSmall+1;
	 } 
}
function playSmallAdd(count)
{
	if(TimerSmall)
	{
		clearInterval(TimerSmall);
	}
	displaySmall(indexSmall);
	TimerSmall=setInterval(function(){displaySmall(indexSmall)},5000);
}
/* Event Add banner*/
var indexEvent=1;
var TimerEvent=0;
function displayEvent(count)
{
	$(".divFlashEvent").css("display","none");
	$("#divFlashEvent_"+count).fadeIn(1000);
	var countEvent = document.getElementById("HFEventCount").value;
	if(indexEvent==countEvent)
	{
		indexEvent=1;
	}
	else
	{ 
		indexEvent=indexEvent+1;
	 } 
}
function playEventAdd(count)
{
	if(TimerEvent)
	{
		clearInterval(TimerEvent);
	}
	displayEvent(indexEvent);
	TimerEvent=setInterval(function(){displayEvent(indexEvent)},5000);
}



