/*----------------------------------------------------------------------------\
|                              Copyright Notice                               |
|-----------------------------------------------------------------------------|
| Created by: Daniyal Hamid (daniyal.hamid@hotmail.com)                       |
| For: HomeopathyNHS.com (http://www.homeopathynhs.com/)                      |
|-----------------------------------------------------------------------------|
| Javascript File Licensed to: HomeopathyNHS.com                              |
| License Type: Commerical Use                                                |
|-----------------------------------------------------------------------------|
|          Copyright (c) 2007 Daniyal Hamid. All Rights Reserved.             |
|-----------------------------------------------------------------------------|
| You may not use any Code contained within this Javascript File without the  |
| prior permission or consent of "Daniyal Hamid". If any part of the code is  |
| found to be used anywhere without the consent or prior permission of        |
| Daniyal Hamid, then Legal Action against that individual or company will    |
| be taken. You must obtain a license from "Daniyal Hamid" in order to use    |
| this Javascript File or any code contained within.                          |
\----------------------------------------------------------------------------*/


function getDocPath() {
	var str = document.location.href;
	var start = str.lastIndexOf('/');
	var end = str.lastIndexOf('.');
	
	var doc_path = str.substring(start+1, end);

	return doc_path;
}

function getLoadType() {
	var str = document.location.href;
	var start = str.lastIndexOf('?');
	var end = str.length;

	var hash = str.lastIndexOf('#');

	var doc_path = '';
	if(start != -1) {
		if(hash == -1) {
			doc_path = str.substring(start+1, end);
		}
		else {
			doc_path = str.substring(start+1, hash);
		}
	}
	else {
		doc_path = "";
	}

	return doc_path;
}

function writeNavbar() {
	var doc_path = getDocPath();
	
	var nav_links = new Array('home', 'services', 'products', 'faq', 'partners', 'contactus', 'about');
	
	for(i=0; i<nav_links.length; i++){
		
		if(nav_links[i] == doc_path) {
			// Set Active Tab
			document.write('<li><a href="' + doc_path + '.htm" title="' + nav_links[i].toUpperCase() + '"><img src="framework/visual/navigation/btn_' + nav_links[i] + '_active.gif" height="23" width="86" alt="' + nav_links[i].toUpperCase() + '" /></a></li>');
		}
		else {
			// Set All Other Tabs
			document.write('<li><a href="' + nav_links[i] + '.htm" title="' + nav_links[i].toUpperCase() + '"><img src="framework/visual/navigation/btn_' + nav_links[i] + '.gif" height="23" width="86" alt="' + nav_links[i].toUpperCase() + '" /></a></li>');
		}
		
	}
}

function opn(loc, w_name, w, h, scroll) {

	var winl = (screen.width-w)/2;
	var wint = (screen.height-h)/2;

	var settings	= 'height=' + h + ',';
	settings 	+= 'width=' + w + ',';
	settings 	+= 'top=' + wint + ',';
	settings 	+= 'left=' + winl + ',';
	settings 	+= 'scrollbars=' + scroll + ',';
	settings 	+= 'resizable=no';
	settings 	+= 'status=no';
	settings 	+= 'titlebar=no';
	settings 	+= 'toolbar=no';

	// Location.htm, Window Name, Settings...
	win=window.open(loc, w_name, settings);

	if(parseInt(navigator.appVersion) >= 4){
		win.window.focus();
	}
};
