<!--

var BROWSER_IE4 = "IE4"
var BROWSER_NN4 = "NN4"
var BROWSER_IE = "IE"
var BROWSER_VER;

if (document.layers) { // Netscape
//    document.captureEvents(Event.MOUSEMOVE);
//    document.onmousemove = captureMousePosition;
} else if (document.all) { // Internet Explorer
    //document.onmousemove = captureMousePosition;
} else if (document.getElementById) { // Netcsape 6
    //document.onmousemove = captureMousePosition;
}
// Global variables
everythingLoaded=false //sets up variable used for JavaScript within the website
xMousePos = 0; // Horizontal position of the mouse on the screen
yMousePos = 0; // Vertical position of the mouse on the screen
xMousePosMax = 0; // Width of the page
yMousePosMax = 0; // Height of the page



function OpenWindow(PageName,PageFrame,PageProperties) { //v2.0
  PageProperties= PageProperties +',scrollbars=1,resizable=1'
  var MyWindow = window.open (PageName,PageFrame,PageProperties);
  
}

function hideTable(tableToHide){
//alert(tableToHide)
if (document.all){
prefix = "document.all";}
else if (document.layers){
prefix = "document.layers";}
holder = eval(prefix)
if (prefix == "document.all"){
holder[tableToHide].style.visibility = 'hidden';}
else if (prefix == "document.layers"){
holder[tableToHide].visibility = 'hidden';}
}

function showTable(tableToShow){

if (document.all){
prefix = "document.all";}
else if (document.layers){
prefix = "document.layers";}
holder = eval(prefix)
if (prefix == "document.all"){
holder[tableToShow].style.visibility = 'visible';}
else if (prefix == "document.layers"){
holder[tableToShow].visibility = 'visible';}
//alert(holder[tableToShow].visibility );
}


function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

// Paraspar's Preload Image Function //
function preloadImage(imageFile)
// The idea behind this is that we can preload all the images
// into an array, we can then circulate through the array at a later
// stage in order to find the specific image we want and load it from
// the array.

{
	if (document.images) {
	// Only run if document.images is supported

		if (document.imageArray==null) document.imageArray = new Array();
		//If the array does not exist, create it.
		
		var arrayLength = document.imageArray.length;
		// Calculate the current length of the array so we can add to it.
		
		document.imageArray[arrayLength] = imageFile;
		document.imageArray[arrayLength + 1] = new Image();
		document.imageArray[arrayLength + 1].src = imageFile; 
		// The even integer part of the array adds the image name
		// The odd integer part of the array adds the image object
		// (i.e. preloads the image into memory).

	}
}



function swapImage(imageName,imageFile)
{
//alert(imageName)
	var swapImageName = eval('document.' + imageName);
	swapImageName.src = imageFile;
	// Replaces the current image with a selected image
	// The images are already preloaded, and therefore can be swapped
	// without reference to the array.
}

function getTop(item){
var top =0;
var mywhere;
mywhere = getMyHTMLElement(item);
	while (mywhere.tagName.toLowerCase() != 'body')
	{
	top += mywhere.offsetTop;
	mywhere = mywhere.offsetParent;
	}
return top;
}

function getLeft(item){
var left =0;
var mywhere;
mywhere = getMyHTMLElement(item);
	while (mywhere.tagName.toLowerCase() != 'body')
	{
	left += mywhere.offsetLeft;
	mywhere = mywhere.offsetParent;
	}
return left;
}



function showIconsTable(tableToShow,position,leftPos,topPos){

if (document.all){
prefix = "document.all";}
else if (document.layers){
prefix = "document.layers";}
holder = eval(prefix)
//alert(holder[tableToShow].style.top);

if (prefix == "document.all"){
holder[tableToShow].style.top = getTop(position) + 10;
holder[tableToShow].style.left = getLeft(position) + 15;
}
else if (prefix == "document.layers"){
holder[tableToShow].top = topPos;
holder[tableToShow].left = leftPos + 5;
}
showTable(tableToShow)
}

function printPage(){
window.print()
}



function showTableMousePosition(tableToShow,position){
	if (document.all){
		prefix = "document.all";}
	else if (document.layers){
		prefix = "document.layers";}
	holder = eval(prefix)

	if (prefix == "document.all"){
		holder[tableToShow].style.top = yMousePos;
		holder[tableToShow].style.left = xMousePos; 
	}
	else if (prefix == "document.layers"){
		holder[tableToShow].top = yMousePos;
		holder[tableToShow].left = xMousePos;
	}
	showTable(tableToShow)
}



function captureMousePosition(e) {
    if (document.layers) {
        xMousePos = e.pageX;
        yMousePos = e.pageY;
        xMousePosMax = window.innerWidth+window.pageXOffset;
        yMousePosMax = window.innerHeight+window.pageYOffset;
    //} else if (document.all) {
        //xMousePos = window.event.x+document.body.scrollLeft;
        //yMousePos = window.event.y+document.body.scrollTop;
        //xMousePosMax = document.body.clientWidth+document.body.scrollLeft;
        //yMousePosMax = document.body.clientHeight+document.body.scrollTop;
    } else if (document.getElementById) {
        xMousePos = e.pageX;
        yMousePos = e.pageY;
        xMousePosMax = window.innerWidth+window.pageXOffset;
        yMousePosMax = window.innerHeight+window.pageYOffset;
    }
}

function LTrim(str)
{
   var whitespace = new String(" \t\n\r");
   var s = new String(str);
   if (whitespace.indexOf(s.charAt(0)) != -1) {
      var j=0, i = s.length;
      while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
         j++;
      s = s.substring(j, i);
   }
   return s;
}
function RTrim(str)
{
   var whitespace = new String(" \t\n\r");
   var s = new String(str);
   if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {
      var i = s.length - 1;
      while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
         i--;
      s = s.substring(0, i+1);
   }
   return s;
}
function Trim(str)
{
   return RTrim(LTrim(str));
}

function checkBrowser() {
var BROWSER_VER;
  if (document.all && !document.getElementById) 
	BROWSER_VER = BROWSER_IE4
  else if (document.layers) 
	BROWSER_VER = BROWSER_NN4
  else if (document.getElementById) 
	BROWSER_VER = BROWSER_IE
  else 
	BROWSER_VER = BROWSER_IE
   return(BROWSER_VER)
}

function getMyHTMLElement(sid)
{
	var oelement;
	BROWSER_VER = checkBrowser()	
	if(BROWSER_VER==BROWSER_IE4)
		oelement = document.all[sid]
	else if(BROWSER_VER==BROWSER_NN4)
		oelement = document.layers[sid]
	else if(BROWSER_VER==BROWSER_IE)
		oelement = document.getElementById(sid)
	else
		oelement = document.getElementById(sid)
	return(oelement)
}


function limittext(field, maxlimit) {
if (field.value.length > maxlimit) 
field.value = field.value.substring(0, maxlimit);
}

function replaceString(aSearch, aFind, aReplace)
    {
    result = aSearch;
    if (result != null && result.length > 0)
        {
        a = 0;
        b = 0;
        while (true)
            {
            a = result.indexOf(aFind, b);
            if (a != -1)
                {
                result = result.substring(0, a) + aReplace + result.substring(a + aFind.length);
                b = a + aReplace.length;
            }
            else
            break;
        }
    }
    return result;
}


function showDisplayTable(tableToShow){
	getMyHTMLElement(tableToShow).style.display=''
}

function hideDisplayTable(tableToHide){
	getMyHTMLElement(tableToHide).style.display='none'
}


var value = 0;
function bookmarksite(title, url){
if (document.all)
window.external.AddFavorite(url, title);
else if (window.sidebar)
window.sidebar.addPanel(title, url, "")
}

function printPage(){window.print()}
function showPopup(link){
    var agt=navigator.userAgent.toLowerCase();
    if (agt.indexOf("opera") != -1 || agt.indexOf("safari") != -1 ) {
        OpenWindow("/fadein.asp?article_id=" + link,"newwin","width=445,height=400")
    }
    else{
        getMyHTMLElement('overlayBox').style.display='';
	getMyHTMLElement('overlayBox').style.width=document.body.clientWidth+ "px";
	getMyHTMLElement('overlayBox').style.height=document.body.clientHeight+ "px";
        getMyHTMLElement('overlayContent').innerHTML = getMyHTMLElement(link).innerHTML;
        if (window.sidebar){fadeTimer = setTimeout("MOZ()",1)}
        if (document.all){fadeTimer = setTimeout("IE()",1)}
    }
}
function hidePopup(link){
    var agt=navigator.userAgent.toLowerCase();
    if (agt.indexOf("opera") != -1 || agt.indexOf("safari") != -1 ) {
        window.close()
    }
    else{

    getMyHTMLElement('overlayContent').style.display='none';
    getMyHTMLElement('overlayBox').style.display='none';
    if (window.sidebar){document.getElementById("overlayBox").style.MozOpacity=0;}
    if (document.all){document.getElementById("overlayBox").filters[0].opacity=0;}
    value = 0;
    //fadeTimer = "";
    }
    }


function IE(){
    if (value < 70){
        value = value + 10
        document.getElementById("overlayBox").filters[0].opacity=value 
        fadeTimer = setTimeout("IE()",1)
    }
    else{
        //getMyHTMLElement('overlayContent').style.top = ((parent.document.body.offsetHeight - 400)/2) + document.documentElement.scrollTop;
	    //getMyHTMLElement('overlayContent').style.left = (parent.document.body.offsetWidth  - 400) /2
	    getMyHTMLElement('overlayContent').style.top = (document.documentElement.clientHeight - 400) / 2 + document.documentElement.scrollTop
	    getMyHTMLElement('overlayContent').style.left = (document.documentElement.clientWidth - 400) / 2
        getMyHTMLElement('overlayContent').style.display='';
    }
}
function MOZ(){
    if (value < 70){
        value = value + 10
        getMyHTMLElement("overlayBox").style.MozOpacity=value/100
        fadeTimer = setTimeout("MOZ()",1)
    }
    else{
    getMyHTMLElement('overlayContent').style.top = ((document.documentElement.clientHeight - 400) / 2) + document.documentElement.scrollTop + 'px'
	getMyHTMLElement('overlayContent').style.left = ((document.documentElement.clientWidth - 400) / 2) + 'px'
    //getMyHTMLElement('overlayContent').style.top = '40%'
	//getMyHTMLElement('overlayContent').style.left = '40%'
    getMyHTMLElement('overlayContent').style.display='';
    //end timeout
    }
}

function changeQty(objName,mathematics){
	place = eval( objName + '.qty')
	place.value = parseInt(place.value) + parseInt(mathematics);
	
	if (place.value < 1)
	{
		place.value = 1;
	}
	if (isNaN(place.value))
	{
		place.value = 1;
	}
}
function replaceString(aSearch, aFind, aReplace)
{
	result = aSearch;
	if (result != null && result.length > 0)
		{
		a = 0;
		b = 0;
		while (true)
			{
			a = result.indexOf(aFind, b);
			if (a != -1)
				{
				result = result.substring(0, a) + aReplace + result.substring(a + aFind.length);
				b = a + aReplace.length;
			}
			else
			break;
		}
	}
	return result;
}
//07-11-2007 change country div tian
tranp=null;
function show_country()
{
    clearTimeout(tranp);
    //getMyHTMLElement("change_country").style.display= "block";
    //getMyHTMLElement("change_country").style.left=  getMyHTMLElement("holder_coutry").offsetLeft+"px";
    //getMyHTMLElement("change_country").style.top=  getMyHTMLElement("holder_coutry").offsetTop+ 20+"px";
}

function change_position()
{    
    //getMyHTMLElement("holder_coutry").style.top= "5px";
    //getMyHTMLElement("holder_coutry").style.left=document.documentElement.clientWidth-140+"px";
    //getMyHTMLElement("change_country").style.left= getMyHTMLElement("holder_coutry").style.left;
    //getMyHTMLElement("change_country").style.top=  getMyHTMLElement("holder_coutry").offsetTop+ 20+"px";
}
function pre_hide()
{
    tranp=setTimeout("hide_country()",2000);
}

function hide_country()
{
   
    getMyHTMLElement("change_country").style.display= "none";
}

function cancel_tran()
{
   
    clearTimeout(tranp);
}

function pre_load()
{
//alert(getMyHTMLElement("div_country").offsetLeft);
    getMyHTMLElement("holder_coutry").style.top= "5px";
    getMyHTMLElement("holder_coutry").style.left=document.documentElement.clientWidth-140+"px";
    getMyHTMLElement("holder_coutry").style.display="block";	
}

function swap_flags(a,b) //a=img  b=type
{
    imgsrc="/images/UK_flag";
    if(a==2) {imgsrc="/images/US_flag"}
     getMyHTMLElement("flag"+a).src=imgsrc+ b+ ".jpg";
    
}
//-->
