/*Browser Detection Script*/
/*Find platform*/
function getPlatform()
{
   var UserAgent;

   UserAgent = navigator.userAgent.toLowerCase();

    if ( (UserAgent.indexOf("win") != -1)   || (UserAgent.indexOf("16bit") != -1))
    {
       return "win";
    }

    if (UserAgent.indexOf("mac") != -1)
    {
       return "mac";
    }
      
    if (UserAgent.indexOf("x11") != -1)
    {
       return "unx";
    }
    return "oth";
}
// --- Get browser version ------------------------------
function getBrowserType()
{
	var browser;
	browser=''
	if (navigator.appName.indexOf("Explorer")!=-1) 
		browser='IE';
		
	if ((navigator.userAgent.indexOf("Opera 6")!=-1)||(navigator.userAgent.indexOf("Opera/6")!=-1))
		browser='OP';

	if (navigator.userAgent.indexOf("Safari")!=-1)
		browser='SF';

	if (browser=='')
		browser='NS';

	return browser;
}

function getBrowserVersion()
{
	var appVersion = navigator.appVersion;
	if (getBrowserType()=='IE')
	{
		index = appVersion.indexOf("MSIE", 0);
		Version = appVersion.substring(index+5, index+6);
		return parseInt(Version);
	}
	
	if (getBrowserType()=='OP')
	{
		var agt=navigator.userAgent.toLowerCase(); 
		if (agt.indexOf("opera/5")!=-1)
		{
			var Version = "5"
		}
		if (agt.indexOf("opera/6")!=-1)
		{
			var Version = "6"
		}
		return parseInt(Version);
	 }	

	 if (getBrowserType()=='NS')
	 {
		var Version = navigator.appVersion;
		return parseInt(Version);	
	 }
}

// --- Get Quick Search Box for the different browser versions.-----------------------------------------------------------------
function GetSearchBox()
{
if (getBrowserType()=='IE' && getPlatform()=='mac')
{
	document.write('<INPUT type="text" name="search" id="Search" value="Search Shop" size="19" maxlength="100" ONFOCUS="clearDefault(this)" title="Enter your search text in this box and click the button to search our shop." class="SearchBoxIEMac">');
}
else if (getBrowserType()=='IE' &&  getBrowserVersion()<6 && getPlatform()=='win')
{
	document.write('<INPUT type="text" name="search" id="Search" value="Search Shop" size="19" maxlength="100" ONFOCUS="clearDefault(this)" title="Enter your search text in this box and click the button to search our shop." class="SearchBoxIEWin">');
}
else if (getBrowserType()=='IE' &&  getBrowserVersion()>=6 && getPlatform()=='win')
{
	document.write('<INPUT type="text" name="search" id="Search" value="Search Shop" size="19" maxlength="100" ONFOCUS="clearDefault(this)" title="Enter your search text in this box and click the button to search our shop." class="SearchBoxIE6Win">');
}

else if (getBrowserType()=='NS' &&  getBrowserVersion()==4 && getPlatform()=='win')
{
	document.write('<INPUT type="text" name="search" id="Search" value="Search Shop" size="14" maxlength="100" ONFOCUS="clearDefault(this)" title="Enter your search text in this box and click the button to search our shop." class="SearchBoxNS4Win">');
}	 
else if (getBrowserType()=='NS' &&  getBrowserVersion()>=5 && getPlatform()=='win')
{
	document.write('<INPUT name="search" id="Search" value="Search Shop" maxlength="100" ONFOCUS="clearDefault(this)" title="Enter your search text in this box and click the button to search our shop." class="SearchBoxNS6Win">');
}
else if (getBrowserType()=='NS' &&  getBrowserVersion()==4 && getPlatform()=='mac')
{
	document.write('<INPUT type="text" name="search" id="Search" value="Search Shop" size="22" maxlength="100" ONFOCUS="clearDefault(this)" title="Enter your search text in this box and click the button to search our shop." class="SearchBoxNS4Mac">');
}	 
else if (getBrowserType()=='NS' &&  getBrowserVersion()>=5 && getPlatform()=='mac')
{
	document.write('<INPUT type="text" name="search" id="Search" value="Search Shop" size="12" maxlength="100" ONFOCUS="clearDefault(this)" title="Enter your search text in this box and click the button to search our shop." class="SearchBoxNS6Mac">');
}

else if (getBrowserType()=='OP' &&  getPlatform()=='mac')
{
	document.write('<INPUT type="text" name="search" id="Search" value="Search Shop" size="19" maxlength="100" ONFOCUS="clearDefault(this)" title="Enter your search text in this box and click the button to search our shop." class="SearchBoxOperaMac">');
}
else if (getBrowserType()=='OP' &&  getBrowserVersion()==5 && getPlatform()=='win')
{
	document.write('<INPUT type="text" name="search" id="Search" value="Search Shop" size="12" maxlength="100" ONFOCUS="clearDefault(this)" title="Enter your search text in this box and click the button to search our shop." class="SearchBoxOpera5Win">');
}	
else if (getBrowserType()=='OP' &&  getBrowserVersion()==6 && getPlatform()=='win')
{
	document.write('<INPUT type="text" name="search" id="Search" value="Search Shop" size="19" maxlength="100" ONFOCUS="clearDefault(this)" title="Enter your search text in this box and click the button to search our shop." class="SearchBoxOpera6Win">');
}	
else if (getBrowserType()=='SF' &&  getPlatform()=='mac')
{
	document.write('<INPUT type="text" name="search" id="Search" value="Search Shop" size="19" maxlength="100" ONFOCUS="clearDefault(this)" title="Enter your search text in this box and click the button to search our shop." class="SearchBoxSafariMac">');
}	

else
{
	document.write('<INPUT type="text" name="search" id="Search" value="Search Shop" size="16" maxlength="100" ONFOCUS="clearDefault(this)" title="Enter your search text in this box and click the button to search our shop." class="SearchBox">');
}
}

// --- Get username box for the different browser versions.-----------------------------------------------------------------
function GetUserNameBox()
{
if (getBrowserType()=='IE' && getPlatform()=='mac')
{
	document.write('<INPUT type="text" name="Login_Name" id="Search" value="" size="19" maxlength="100" title="Enter your username." class="UsernameBoxIEMac">');
}
else if (getBrowserType()=='IE' &&  getBrowserVersion()<6 && getPlatform()=='win')
{
	document.write('<INPUT type="text" name="Login_Name" id="Search" value="" size="19" maxlength="100" title="Enter your username." class="UsernameBoxIEWin">');
}
else if (getBrowserType()=='IE' &&  getBrowserVersion()>=6 && getPlatform()=='win')
{
	document.write('<INPUT type="text" name="Login_Name" id="Search" value="" size="19" maxlength="100" title="Enter your username." class="UsernameBoxIE6Win">');
}

else if (getBrowserType()=='NS' &&  getBrowserVersion()==4 && getPlatform()=='win')
{
	document.write('<INPUT type="text" name="Login_Name" id="Search" value="" size="14" maxlength="100" title="Enter your username." class="UsernameBoxNS4Win">');
}	 
else if (getBrowserType()=='NS' &&  getBrowserVersion()>=5 && getPlatform()=='win')
{
	document.write('<INPUT type="text" name="Login_Name" id="Search" value="" maxlength="100" title="Enter your username." class="UsernameBoxNS6Win">');
}
else if (getBrowserType()=='NS' &&  getBrowserVersion()==4 && getPlatform()=='mac')
{
	document.write('<INPUT type="text" name="Login_Name" id="Search" value="" size="22" maxlength="100" title="Enter your username." class="UsernameBoxNS4Mac">');
}	 
else if (getBrowserType()=='NS' &&  getBrowserVersion()>=5 && getPlatform()=='mac')
{
	document.write('<INPUT type="text" name="Login_Name" id="Search" value="" size="12" maxlength="100" title="Enter your username." class="UsernameBoxNS6Mac">');
}

else if (getBrowserType()=='OP' &&  getPlatform()=='mac')
{
	document.write('<INPUT type="text" name="Login_Name" id="Search" value="" size="19" maxlength="100" title="Enter your username." class="UsernameBoxOperaMac">');
}
else if (getBrowserType()=='OP' &&  getBrowserVersion()==5 && getPlatform()=='win')
{
	document.write('<INPUT type="text" name="Login_Name" id="Search" value="" size="12" maxlength="100" title="Enter your username." class="UsernameBoxOpera5Win">');
}	
else if (getBrowserType()=='OP' &&  getBrowserVersion()==6 && getPlatform()=='win')
{
	document.write('<INPUT type="text" name="Login_Name" id="Search" value="" size="19" maxlength="100" title="Enter your username." class="UsernameBoxOpera6Win">');
}	
else if (getBrowserType()=='SF' &&  getPlatform()=='mac')
{
	document.write('<INPUT type="text" name="Login_Name" id="Search" value="" maxlength="100" title="Enter your username." class="UsernameBoxSafariMac">');
}	

else
{
	document.write('<INPUT type="text" name="Login_Name" id="Search" value="" size="16" maxlength="100" title="Enter your username." class="UsernameBox">');
}
}

// --- Get password box for the different browser versions.-----------------------------------------------------------------
function GetPasswordBox()
{
if (getBrowserType()=='IE' && getPlatform()=='mac')
{
	document.write('<INPUT type=password  name="Password" id="Search" value="" size="19" maxlength="100" title="Enter your password." class="PasswordBoxIEMac">');
}
else if (getBrowserType()=='IE' &&  getBrowserVersion()<6 && getPlatform()=='win')
{
	document.write('<INPUT type=password  name="Password" id="Search" value="" size="19" maxlength="100" title="Enter your password." class="PasswordBoxIEWin">');
}
else if (getBrowserType()=='IE' &&  getBrowserVersion()>=6 && getPlatform()=='win')
{
	document.write('<INPUT type=password  name="Password" id="Search" value="" size="19" maxlength="100" title="Enter your password." class="PasswordBoxIE6Win">');
}

else if (getBrowserType()=='NS' &&  getBrowserVersion()==4 && getPlatform()=='win')
{
	document.write('<INPUT type=password  name="Password" id="Search" value="" size="14" maxlength="100" title="Enter your password." class="PasswordBoxNS4Win">');
}	 
else if (getBrowserType()=='NS' &&  getBrowserVersion()>=5 && getPlatform()=='win')
{
	document.write('<INPUT type=password  name="Password" id="Search" value="" maxlength="100" title="Enter your password." class="PasswordBoxNS6Win">');
}
else if (getBrowserType()=='NS' &&  getBrowserVersion()==4 && getPlatform()=='mac')
{
	document.write('<INPUT type=password  name="Password" id="Search" value="" size="22" maxlength="100" title="Enter your password." class="PasswordBoxNS4Mac">');
}	 
else if (getBrowserType()=='NS' &&  getBrowserVersion()>=5 && getPlatform()=='mac')
{
	document.write('<INPUT type=password  name="Password" id="Search" value="" size="12" maxlength="100" title="Enter your password." class="PasswordBoxNS6Mac">');
}

else if (getBrowserType()=='OP' &&  getPlatform()=='mac')
{
	document.write('<INPUT type=password  name="Password" id="Search" value="" size="19" maxlength="100" title="Enter your password." class="PasswordBoxOperaMac">');
}
else if (getBrowserType()=='OP' &&  getBrowserVersion()==5 && getPlatform()=='win')
{
	document.write('<INPUT type=password  name="Password" id="Search" value="" size="12" maxlength="100" title="Enter your password." class="PasswordBoxOpera5Win">');
}	
else if (getBrowserType()=='OP' &&  getBrowserVersion()==6 && getPlatform()=='win')
{
	document.write('<INPUT type=password  name="Password" id="Search" value="" size="19" maxlength="100" title="Enter your password." class="PasswordBoxOpera6Win">');
}	
else if (getBrowserType()=='SF' &&  getPlatform()=='mac')
{
	document.write('<INPUT type=password  name="Password" id="Search" value="" maxlength="100" title="Enter your password." class="PasswordBoxSafariMac">');
}	

else
{
	document.write('<INPUT type=password  name="Password" id="Search" value="" size="16" maxlength="100" title="Enter your password." class="PasswordBox">');
}
}


// Search Box Clear Function ===========================

function clearDefault(el) {
  if (el.defaultValue==el.value) el.value = ""
}


