var idWindow='window';
var idCookie='warning_shown';

function ShowWarning()
{
	if(popUpEnabled && !Get_Cookie(idCookie))
	{
		Set_Cookie(idCookie, 1, '', '/', '', '');
		ShowWindow('<button onClick="HideWindow()" class="x">X</button><h3>'+popUpHeader+'</h3><p>'+popUpBody+'</p><button onClick="HideWindow()">Close</button>');
	}
}

function ShowWindow(code)
{
	var obj=document.getElementById(idWindow);
	obj.innerHTML=code;
	obj.style.display='block';
	try { document.getElementById('firstField').focus(); } catch(e) {}
}

function HideWindow()
{
	var obj=document.getElementById(idWindow);
	obj.style.display='none';
	obj.innerHTML="";
}

function insertFlash(url, width, height, alt_text, is_transparent, object_id)
{
	document.write('<object ');
	if(object_id) document.write('id="'+object_id+'" ');
	document.writeln('classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+width+'" height="'+height+'" alt="'+alt_text+'">');
	document.writeln('<param name=movie value="'+url+'"');
	document.writeln('<param name=quality value=high>');
	if(is_transparent>0) document.writeln('<param name="wmode" value="transparent">');
	document.write('<embed src="'+url+'" quality=high pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'" ');
	if(is_transparent>0) document.write('wmode="transparent" ');
	document.writeln('alt="'+alt_text+'"></embed>');
	document.writeln('</object>');
}

function viewer(file, desc)
{
	var obj=window.open('viewer.html?'+file+'&'+desc, 'viewer', 'width=300,height=300,left=200,top=200,status=no,scrollbars=no,resizable=yes,location=no,menubar=no,toolbar=no');
	                                                                                            
	if(obj==null || typeof(obj)=="undefined")
	{
		alert("Please disable pop-up blocker feature of your browser.");
	}
}

function dirMap(url)
{
	var obj=window.open(url, 'directions_map', 'width=300,height=300,left=200,top=200,status=no,scrollbars=no,resizable=yes,location=no,menubar=no,toolbar=no');
	                                                                                            
	if(obj==null || typeof(obj)=="undefined")
	{
		alert("Please disable pop-up blocker feature of your browser.");
	}
}

function valForm(form)
{
	for(var i in form.elements)
	{
		try
		{
			if((form.elements[i].type=="text" || form.elements[i].type=="textarea") && form.elements[i].className=="required" && form.elements[i].value=="")
			{
				alert("Please fill all the required fields.");
				form.elements[i].focus();
				return false;
			}
		}
		catch(e) {}
	}
	return true;
}

function resizeToID(divID, isLoop)
{
	var px=0;
	var py=0;
	var cx=document.documentElement.clientWidth;
	var cy=document.documentElement.clientHeight;

	var comWW="document.documentElement.clientWidth-20";
	var comWH="document.documentElement.clientHeight-20";
	
	if(/Netscape/.test(navigator.appName))
	{
		resizeBy(document.getElementById(divID).offsetWidth+40, 0);
	}	
	else if(window.opera)
	{
		resizeBy(document.getElementById(divID).offsetWidth+40, 0);
		comWW="window.innerWidth-56";
		comWH="window.innerHeight-20";
	}	
	eval("cx="+comWW); eval("cy="+comWH);

	while(!(px==cx && py==cy))
	{
		px=cx; py=cy;
		var dx=document.getElementById(divID).offsetWidth-cx;
		var dy=document.getElementById(divID).offsetHeight-cy;
		//alert("dx="+dx+" dy="+dy);
		moveTo(screen.availWidth/2-(cx+dx)/2, screen.availHeight/2-(cy+dy)/2);
		resizeBy(dx, dy);
		eval("cx="+comWW); eval("cy="+comWH);
		moveTo(screen.availWidth/2-cx/2, screen.availHeight/2-cy/2);
		if(isLoop!=1 || window.opera) break;
	}
}

function Set_Cookie( name, value, expires, path, domain, secure ) 
{
  // set time, it's in milliseconds
  var today = new Date();
  today.setTime( today.getTime() );

  // expires is specified in days
	// if expires=='' cookie will only last as long as the current session of the visitor

  /*
  if the expires variable is set, make the correct 
  expires time, the current script below will set 
  it for x number of days, to make it for hours, 
  delete * 24, for minutes, delete * 60 * 24
  */
  if ( expires )
  {
    expires = expires * 1000 * 60 * 60 * 24;
  }
  var expires_date = new Date( today.getTime() + (expires) );

  document.cookie = name + "=" +escape( value ) +
  ( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
  ( ( path ) ? ";path=" + path : "" ) + 
  ( ( domain ) ? ";domain=" + domain : "" ) +
  ( ( secure ) ? ";secure" : "" );
}


function Get_Cookie( check_name )
{
	// first we'll split this cookie up into name/value pairs
	// note: document.cookie only returns name=value, not the other components
	var a_all_cookies = document.cookie.split( ';' );
	var a_temp_cookie = '';
	var cookie_name = '';
	var cookie_value = '';
	var b_cookie_found = false; // set boolean t/f default f
	
	for ( i = 0; i < a_all_cookies.length; i++ )
	{
		// now we'll split apart each name=value pair
		a_temp_cookie = a_all_cookies[i].split( '=' );
		// and trim left/right whitespace while we're at it
		cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');
		
		// if the extracted name matches passed check_name
		if ( cookie_name == check_name )
		{
			b_cookie_found = true;
			cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
			return cookie_value;
			break;
		}
		a_temp_cookie = null;
		cookie_name = '';
	}
	if ( !b_cookie_found )
	{
		return null;
	}
}

function Delete_Cookie( name, path, domain )
{
  if ( Get_Cookie( name ) ) document.cookie = name + "=" +
  ( ( path ) ? ";path=" + path : "") +
  ( ( domain ) ? ";domain=" + domain : "" ) +
  ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

///faqs

function allshow(){
	for(var di=1;di<11;di++){
	showhide("a"+di, 'on');
	}
};

function allhide(){
	for(var di=1;di<11;di++){
	showhide("a"+di, 'off');
	}
};

function showhide(id, f){
		if(document.getElementById(id).style.display == 'block')
			{document.getElementById(id).style.display = 'none';
			document.getElementById(id+'a').style.backgroundPosition='0px 3px';}
		else {document.getElementById(id).style.display = 'block';
			document.getElementById(id+'a').style.backgroundPosition='0px -14px';
			//var tmp = new String;
			//tmp = document.getElementById(id).innerHTML;
			//document.getElementById(id).innerText = "";
			//for(var i=0;i<tmp.length;i++){
				//document.getElementById(id).innerText += tmp.charAt(i);
				//}
			}
		if(f == 'off') {document.getElementById(id).style.display = 'none'; document.getElementById(id+'a').style.backgroundPosition='0px 3px';}
		if(f == 'on') {document.getElementById(id).style.display = 'block'; document.getElementById(id+'a').style.backgroundPosition='0px -14px';}
};

//end faqs

