var divid = new Array();
var flagdiv = new Array();
var divinc=0;
function HideCont(d) {
if(d.length < 1) { return; }
flagdiv[di]=false;
for(id in divid){
	if(document.getElementById(id))
		document.getElementById(id).style.display = "none";
}
}
function ShowCont(d) {
if(d.length < 1) { return; }
document.getElementById(d).style.display = "block";
}
function RevDisplay(d) {
	if(d.length < 1) { return; }
	if(document.getElementById(d).style.display == "none") { 
	for(id in divid){
		if(document.getElementById(id))
			document.getElementById(id).style.display = "none";
	}
		di=d;
		flagdiv[di]=true;
		setTimeout("showdiv()",400);
		
	}else { document.getElementById(d).style.display = "none"; }
}

function showdiv()
{
	if(flagdiv[di]==true){
		if(document.getElementById(di).style.display == "none") { 
			divid[di]=di;
			document.getElementById(di).style.display = "block";
		}
	}
}

function popitup(url) {
	newwindow=window.open(url,'name','height=300,width=400');
	if (window.focus) {newwindow.focus()}
	return false;
}

function popcallbackup(url) {
	newwindow=window.open(url,'name','height=563,width=331');
	if (window.focus) {newwindow.focus()}
	return false;
}
function popitupbig(url) {
	newwindow=window.open(url,'name','height=400,width=450');
	if (window.focus) {newwindow.focus()}
	return false;
}

/*			var floatingMenuId = 'topsection2';
			var floatingMenu =
			{
				targetX: 0,
				targetY: 0,
				hasInner: typeof(window.innerWidth) == 'number',
				hasElement: document.documentElement && document.documentElement.clientWidth,		
				menu:
					document.getElementById
					? document.getElementById(floatingMenuId)
					: document.all
					  ? document.all[floatingMenuId]
					  : document.layers[floatingMenuId]
			};
			
			floatingMenu.move = function ()
			{
				if (document.layers)
				{
					floatingMenu.menu.left = floatingMenu.nextX;
					floatingMenu.menu.top = floatingMenu.nextY;
				}
				else
				{
					floatingMenu.menu.style.left = floatingMenu.nextX + 'px';
					floatingMenu.menu.style.top = floatingMenu.nextY + 'px';
				}
			}
			
			floatingMenu.computeShifts = function ()
			{
				var de = document.documentElement;
			
				floatingMenu.shiftX =
					floatingMenu.hasInner
					? pageXOffset
					: floatingMenu.hasElement
					  ? de.scrollLeft
					  : document.body.scrollLeft;
				if (floatingMenu.targetX < 0)
				{
					if (floatingMenu.hasElement && floatingMenu.hasInner)
					{
						floatingMenu.shiftX +=
							de.clientWidth > window.innerWidth
							? window.innerWidth
							: de.clientWidth
					}
					else
					{
						floatingMenu.shiftX +=
							floatingMenu.hasElement
							? de.clientWidth
							: floatingMenu.hasInner
							  ? window.innerWidth
							  : document.body.clientWidth;
					}
				}
			
				floatingMenu.shiftY = 
					floatingMenu.hasInner
					? pageYOffset
					: floatingMenu.hasElement
					  ? de.scrollTop
					  : document.body.scrollTop;
				if (floatingMenu.targetY < 0)
				{
					if (floatingMenu.hasElement && floatingMenu.hasInner)
					{
						floatingMenu.shiftY +=
							de.clientHeight > window.innerHeight
							? window.innerHeight
							: de.clientHeight
					}
					else
					{
						floatingMenu.shiftY +=
							floatingMenu.hasElement
							? document.documentElement.clientHeight
							: floatingMenu.hasInner
							  ? window.innerHeight
							  : document.body.clientHeight;
					}
				}
			}
			
			floatingMenu.doFloat = function()
			{
				var stepX, stepY;
			
				floatingMenu.computeShifts();
			
				stepX = (floatingMenu.shiftX + 
					floatingMenu.targetX - floatingMenu.nextX) * .07;
				if (Math.abs(stepX) < .5)
				{
					stepX = floatingMenu.shiftX +
						floatingMenu.targetX - floatingMenu.nextX;
				}
			
				stepY = (floatingMenu.shiftY + 
					floatingMenu.targetY - floatingMenu.nextY) * .07;   // changed
				if (Math.abs(stepY) < .5)
				{
					stepY = floatingMenu.shiftY + 
						floatingMenu.targetY - floatingMenu.nextY;
				}
			
				if (Math.abs(stepX) > 0 ||
					Math.abs(stepY) > 0)
				{
					floatingMenu.nextX += stepX;
					floatingMenu.nextY += stepY;
					floatingMenu.move();
				}
			
				setTimeout('floatingMenu.doFloat()', 20); // changed 20
			};
			
			floatingMenu.addEvent = function(element, listener, handler)
			{
				if(typeof element[listener] != 'function' || 
				   typeof element[listener + '_num'] == 'undefined')
				{
					element[listener + '_num'] = 0;
					if (typeof element[listener] == 'function')
					{
						element[listener + 0] = element[listener];
						element[listener + '_num']++;
					}
					element[listener] = function(e)
					{
						var r = true;
						e = (e) ? e : window.event;
						for(var i = element[listener + '_num'] -1; i >= 0; i--)
						{
							if(element[listener + i](e) == false)
								r = false;
						}
						return r;
					}
				}
			
				for(var i = 0; i < element[listener + '_num']; i++)
					if(element[listener + i] == handler)
						return;
				element[listener + element[listener + '_num']] = handler;
				element[listener + '_num']++;
			};
			
			floatingMenu.init = function()
			{
				floatingMenu.initSecondary();
				floatingMenu.doFloat();
			};

			floatingMenu.initSecondary = function()
			{
				floatingMenu.computeShifts();
				floatingMenu.nextX = floatingMenu.shiftX +
					floatingMenu.targetX;
				floatingMenu.nextY = floatingMenu.shiftY +
					floatingMenu.targetY;
				floatingMenu.move();
			}
			
			if (document.layers)
				floatingMenu.addEvent(window, 'onload', floatingMenu.init);
			else
			{
				floatingMenu.init();
				floatingMenu.addEvent(window, 'onload',
					floatingMenu.initSecondary);
			}*/
		
			function getCookie(c_name)
			{
				if (document.cookie.length>0)
				{
					c_start=document.cookie.indexOf(c_name + "=");
					if (c_start!=-1)
					{ 
						c_start=c_start + c_name.length+1; 
						c_end=document.cookie.indexOf(";",c_start);
						if (c_end==-1) c_end=document.cookie.length;
						return unescape(document.cookie.substring(c_start,c_end));
					} 
				}
				return "";
			}
		
			function setCookie(time_value,expiredays,flagvalue)
			{
				var exdate=new Date();
				exdate.setDate(exdate.getDate()+expiredays);
				document.cookie="timer=" +escape(time_value)+ ((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
				document.cookie= "flag=" +escape(flagvalue)+ ((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
			}
		
			function checkCookie(sessionid,image_path)
			{
		//		var sessionid =  '{php} echo session_id(); {/php}';
				//alert(image_path);
				
				cookiessessid =getCookie('sessionid');
				if(cookiessessid != sessionid) 
				{
					
					var exdate=new Date();
					var expiredays = 30;
					exdate.setDate(exdate.getDate()+expiredays);
					document.cookie= "sessionid=" +escape(sessionid)+ ((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
					document.cookie="timer=" +escape(0)+ ((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
					document.cookie= "flag=false" + ((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
				}
				timer=getCookie('timer');
				if (timer!=null && timer!="")
				{
					increaseTimer(image_path);
				}
				else 
				{
					setCookie(1,30,'true');
					increaseTimer(image_path);
				}
			}
			
			function increaseTimer(image_pathg)
			{
				timer=getCookie('timer');
				if(timer>=20)
				{
					if(getCookie('flag')=='true')
					{
						document.getElementById('arrowdiv').innerHTML='<img src="/images/arrow-image.png" style="float:right; position:absolute; margin-top:155px; margin-left:-660px;  z-index:4000; opacity:0.0;#filter:alpha(opacity=0)" id="request_arrow" />';
						popup();
					}
				}
				else
				{
					setCookie(parseInt(timer)+1,30,'true');
					setTimeout( "increaseTimer()",1000);	
				}
			}
		
			var i=0;
			var j=0;
			var flag=1;
			var flagPopout=1;
			flagArrow='true';
			var bylink=false;
		
			function popup()
			{
				if(flag==1)
				{
					popupOne();
				}
			}
			
			function popupOne()
			{	
				
				if(i<224)
				{
					i=i+2;
					elem = document.getElementById('request_service');
					elem.style.display='block';
					elem.style.height=i+'px';
					elem.style.overflow='hidden';	
					setTimeout( "popup()",1);
				}
				else
				{
					setCookie(20,30,'false');
					setTimeout( "popout()",20000);
					flagArrow='true';
					flag=0;	
					if(bylink==false)
					popupArrow();
					
				}
			}
			
			function popupArrow()
			{
				j=j+2;
				if(j<=100 && flagArrow=='true')
					{
						document.getElementById('request_arrow').style.opacity=0.01*j;
						document.getElementById('request_arrow').style.filter = 'alpha(opacity=' +j+ ')';
						setTimeout( "popupArrow()",1);
					}
			}
			function popout()
			{
				if(flagPopout)
				{
					i=i-2;
					if(i<=0 || i==null)
					i=0;
					elem = document.getElementById('request_service');
					elem.style.height=i+'px';
					elem.style.overflow='hidden';
					if(document.getElementById('request_arrow'))
					{
						if(i<=100){
							if(j>=0)
							{
								j=j-2;
								document.getElementById('request_arrow').style.opacity=0.01*j;
								document.getElementById('request_arrow').style.filter = 'alpha(opacity=' + j+ ')';
								flagArrow='flase';
							}
							if(j==0)
							{
								document.getElementById('arrowdiv').innerHTML='';
							}
						}
					}
					if(i>0){
						setTimeout( "popout()",1);
					}
					else{
					elem.style.display='none';
					}	
				}
			flag=1;
			}
			function openform(image_path)
			{
				flagPopout=0;
				if(flag)
				{
				//document.getElementById('arrowdiv').innerHTML='<img src="http://67.205.20.69/images/arrow-image.png" style="float:right; position:absolute; margin-top:155px; margin-left:-660px;  z-index:4000; opacity:0.0;#filter:alpha(opacity=0)" id="request_arrow" />';
				bylink=true;
				popup();
				}
			}
