    function createCookie(name,value)
    {
    	//This method will create cookie with the value for the name given to it.
    	if(typeof name != "undefined" && typeof value != "undefined")
    	{
	    	var days = true;
	    	if(days == null || days == "undefined")
	    	{
	    		days = fasle;
	    	}
			if (days) 
			{
				var date = new Date();
				date.setTime(date.getTime()+(2*60*60*1000));
				var expires = "; expires="+date.toGMTString();
				//var expires = ((expires == null) ? "" : ("; expires=" + expires.toGMTString()))
			}
			else 
			{
				var expires = "";
			}
			//TODO the domain have to be set for this
			document.cookie = name+"="+value+expires;
		}
		else
		{
			//alert("Parameters passed to the createCookie is not correct \n Usage createCookie(cookieName,cookieValue)");
		}
	}
	
	function createCookieWithNoExpiry(name,value)
    {
    	//This method will create cookie with the value for the name given to it.
    	if(typeof name != "undefined" && typeof value != "undefined")
    	{
	    	var days = true;
	    	if(days == null || days == "undefined")
	    	{
	    		days = fasle;
	    	}
			if (days) 
			{
				var date = new Date();
				date.setTime(date.getTime()+(12*30*60*60*60*1000));
				var expires = "; expires="+date.toGMTString();
				//var expires = ((expires == null) ? "" : ("; expires=" + expires.toGMTString()))
			}
			else 
			{
				var expires = "";
			}
			document.cookie = name+"="+value+expires;
		}
		else
		{
			//alert("Parameters passed to the createCookie is not correct \n Usage createCookie(cookieName,cookieValue)");
		}
	}
		function readCookie(c_name)
		{
			//This method will check for the existence of the cookie with the specified format
			//For ex if the cookie name is zoho-ticket ,we can give input as '-ticket' and it will return 'zoho-ticket'
			//One exclution it will search for single isntance,it is valid in our case but it is not eneric
			var username = "";
			var cookinDoc = document.cookie.split(";");
			if(cookinDoc != null && cookinDoc != "undefined" && cookinDoc != "")
			{
				for(var i=0;i<cookinDoc.length;i++)
				{
					if(cookinDoc[i].indexOf(c_name) != -1)
					{
						username = (cookinDoc[i].split('=')[0]);

						return username;
					}
				}
			}
			else
			{
				return "";
			}
		}
	
	
	
	function eraseCookieWithoutReload( name) 
	{
		if( readCookie( name ) != null )
		{
			var Cname = readCookie(name);
			document.cookie = Cname + "= ;expires=-1";
		}
	}
	
		function getCookieValue(name)
		{
			var cooName = readCookie(name);
			var tmpCookie = document.cookie.split(";");
			for(var i=0;i<tmpCookie.length;i++)
			{
				if(tmpCookie[i].indexOf(cooName) != -1)
				{
					var Cvalue = tmpCookie[i].split("=");
					//alert(" The value of cookie " + cooName + " is ::" + Cvalue[1]);
					return Cvalue[1];
				}
			}
			return ""
		}
	
    function extendExpiryTime()
	{
			var tmpCookie = document.cookie.split(";");
			for(var i=0;i<tmpCookie.length;i++)
			{
				if(tmpCookie[i].indexOf("EATICKET") != -1 || 
					tmpCookie[i].indexOf("USERID") != -1 ||
					tmpCookie[i].indexOf("USERNAME") != -1 ||
					tmpCookie[i].indexOf("FFT") != -1)
				{
					var Cvalue = tmpCookie[i].split("=");
					var nnam = Cvalue[0]
					var vval =  Cvalue[1];
					createCookie(nnam,vval);
				}
			}
	}
    function removeIAMCookie(iFmeurl)
    {
    	try
	    {
	    	var iFmeObj = document.getElementById("iFme");
	    	//Here want to set the url for setting iamAgentCookie
	    	if(typeof iFmeurl != "undefined")
	    	{
	    		iFmeObj.src = iFmeurl;
               
	    	}
	    	iFmeObj.src;
    	}
   		catch(e)
   		{
   			//console.log("Exceptionqq in IAM ::" + e);
   		}
    }
