function getWindowHeight()
{
    var windowHeight=0;
    if (typeof(window.innerHeight)=='number') {
        windowHeight=window.innerHeight;
    } else {
        if (document.documentElement && document.documentElement.clientHeight) {
            windowHeight = document.documentElement.clientHeight;
        } else {
            if (document.body&&document.body.clientHeight) {
                windowHeight=document.body.clientHeight;
            }
        }
    }

    return windowHeight;
}

function getScrollHeight()
{
    var scrollHeight=0;
    if (typeof(window.scrollHeight)=='number') {
        scrollHeight=window.scrollHeight;
    } else {
        if (document.documentElement && document.documentElement.scrollHeight) {
            scrollHeight = document.documentElement.scrollHeight;
        } else {
            if (document.body&&document.body.scrollHeight) {
                scrollHeight=document.body.scrollHeight;
            }
        }
    }

    return scrollHeight;
}


// can now take an array for the div's
function switchDivs(div_to_show, div_to_hide)
{
    if (document.getElementById) {
        
		show_divs = new Array();
		
		if(!isArray(div_to_show)){
			show_divs[0] = div_to_show;
		}else{
			show_divs = div_to_show;
		}
        
		for(n=0; n < show_divs.length; n++){
			this_div = document.getElementById(show_divs[n]);
    	    this_div.style.display = "";
    	}
		
		
		hide_divs = new Array();
		
		if(!isArray(div_to_hide)){
			hide_divs[0] = div_to_hide;
		}else{
			hide_divs = div_to_hide;
		}
        
		for(n=0; n < hide_divs.length; n++){
			this_div = document.getElementById(hide_divs[n]);
    	    this_div.style.display = "none";
    	}
	}
}


//chk if an object is an array or not.
function isArray(obj) 
{
	//returns true is it is an array
	if (obj.constructor.toString().indexOf('Array') == -1){
		return false;
	}else{
		return true;
	}
}


// cart clear all
function clearAllCartFields(form)
{
	for (i = 0; i < document[form].elements.length; i++){ 
     	if (document[form].elements[i].type == "text"){
	 		document[form].elements[i].value = 0;
		}
	}
}

function checkAllFields(name)
{
	var f = document.form;
	for (i = 0; i < f.elements.length; i++){ 
     	if (f.elements[i].type == "checkbox" && f.elements[i].name == name){
	 		f.elements[i].checked = true;
		}
	}
}

/*
function checkAll(field) 
{ 
	arySelectedIndexes=new Array();  
	l = field.elements.length; 
	for (i = 0; i < l; i++) { 
		if (field.elements[i].type == "checkbox"){
			if (field.elements[i].name != 'newwindow'){
				field.elements[i].checked = true;
			}
			pct = parseInt(i/l*100);
		}
		if (pct % 5 == 0) {
			window.status = 'Working (' + pct + '%)';
		}
	} 
	window.status = 'Done';
}
*/