_inAdmin = false;
CurrentFocus = null;
$(document).ready(function(){
	$(".yellowbutton").mousedown(function(){
		$(this).removeClass("yellowbutton").addClass("yellowbutton_down");
	}).mouseup(function(){
		$(this).removeClass("yellowbutton_down").addClass("yellowbutton");
	});
	_pageHeight = $("#contentTable2").height();
	if(!und(_pageHeight) && _pageHeight < 600){
		$("#pageSpacer").height(600 - _pageHeight).css({width:"100%"});
		$("#leftnav").height(560);
	}
	_lni = gid("leftNavImg");
	if(!und(_lni) && _lni.offsetTop < $("#leftnav").height() - $(_lni).height()){
		_lni.style.top = $("#leftnav").height() - $(_lni).height()-75;  
	}
});
function focusdiv(obj){	
	/*if(CurrentFocus != null){
		try{
		CurrentFocus.parentNode.removeChild(CurrentFocus);
		CurrentFocus = null;
		}catch(e){}
	}
	newdivcopy(obj);
	*/
	addClass(getChildElements(obj)[0],"overdiv")
}
function cancelevent(e){
	var x = new myevent(e);
	x.cancelBubble();
}
function fadediv(obj){
	/*try{
	CurrentFocus.parentNode.removeChild(CurrentFocus);
	CurrentFocus = null;
	}catch(e){}*/
	removeClass(getChildElements(obj)[0],"overdiv")
}

function newdivcopy(indiv){
	var d = new myce("div");
	d.style.width = indiv.clientWidth;
	d.style.height = indiv.clientHeight;
	d.style.position = "absolute";
	d.style.top = getTop(indiv);
	d.style.left = getLeft(indiv);
	d.style.zIndex = 1;
	d.setAttribute("identify","yellow");
	d.innerHTML = indiv.innerHTML;		
	var c = getChildElements(d);
	for(var z=0;z<c.length;z++){
		addEvent(c[z],"mouseover",cancelevent);
		addEvent(c[z],"mouseout",cancelevent);
	}
	
	d.style.backgroundColor = "#dddddd";
	setOpacity(d,45);
	d.style.cursor = "pointer";
	addEvent(d,"mouseout",fadediv);
	CurrentFocus = d;
	getBody().appendChild(d);	
}
function launchApp(app, mode){
	if(mode == "wide"){
		var target = window;
		if(window.parent != window){
			target = window.parent;
		}
		target.location = "/CATApps/ApplicationMaster.jsp?app=" + app + "&mode=wide";
	} else if(mode == "blank"){
		alert("blank");
		location.href = app;
		
	}else {
		if(mode == "popup"){
			//window.open("/CATApps/ApplicationMaster.jsp?app=" + app + "&mode=popup", "CAT_APPS", "channelmode=No, directories=No, location=No, menubar=No, resizable=Yes, status=No, scrollbars=Yes, titlebar=Yes, toolbar=Yes");
			window.open("/CATApps/ApplicationMaster.jsp?app=" + app + "&mode=popup", "CAT_APPS", "directories=No, location=No, menubar=No, resizable=Yes, status=No, scrollbars=No, titlebar=Yes, toolbar=Yes");
			
		} else {
			window.open("/CATApps/ApplicationMaster.jsp?app=" + app + "&mode=" + mode, "content", ",channelmode=No, directories=No, location=No, menubar=No, resizable=Yes, status=No, scrollbars=Yes, titlebar=Yes, toolbar=Yes");
		}
	}
}
function viewPartStoreMovie(){
	window.open("/video/partstore/FinalMovie.html", "content", "width=820, height=500,channelmode=No, directories=No, location=No, menubar=No, resizable=Yes, status=No, scrollbars=Yes, titlebar=Yes, toolbar=No");
}
function signup(url, mode){
	if(mode == "wide"){
		var target = window;
		if(window.parent != window){
			target = window.parent;
		}
		target.location = "../PageMaster.jsp?page=CATApps/ApplicationMaster.jsp?url=" + url + "&navigation=CATApps/navigation.jsp&useFrames=Content/Nav&mode=wide";
	} else {	
		if(mode == "popup"){
			window.open("/CATApps/ApplicationMaster.jsp?url=" + url + "&mode=popup", "CAT_APPS",  "width=650, height=500,channelmode=No, directories=No, fullscreen=No, location=No, menubar=No, resizable=Yes, status=No, scrollbars=No, titlebar=Yes, toolbar=No");
		} else {		
			window.open("/CATApps/ApplicationMaster.jsp?url=" + url + "&mode=" + mode, "content",  "width=650, height=500,channelmode=No, directories=No, fullscreen=No, location=No, menubar=No, resizable=Yes, status=No, scrollbars=No, titlebar=Yes, toolbar=No");
		}
	}
}

function popupPage(url,width,height){
	window.open(url, "Wheelercat_com",  "width="+width+",height="+height+",channelmode=No,directories=No,fullscreen=No,location=No,menubar=No,resizable=Yes,status=No,scrollbars=Yes,titlebar=Yes,toolbar=No");		
}

function openPrivacy(){
	window.open("/privacy.html", "PrivacyStatement",  "width=350,height=450,channelmode=No,directories=No,fullscreen=No,location=No,menubar=No,resizable=Yes,status=No,scrollbars=Yes,titlebar=Yes,toolbar=No");	
}
function openLegal(){
	window.open("/legalnotice.html", "LegalNotice",  "width=350,height=450,channelmode=No,directories=No,fullscreen=No,location=No,menubar=No,resizable=Yes,status=No,scrollbars=Yes,titlebar=Yes,toolbar=No");	
}
/*
function quicklinkGo(e){
	var xe = new myevent(e);
	if(e.enterKey){
		alert(enter key);
	}	

}*/
_hasGone = false;
function quicklinkGoFoIE(){
	if(!_hasGone){
		var s = gid("quicklinksSelect");
		var opt = s.options[s.selectedIndex];
		if(opt.getAttribute("ref")){ //gotopage
			window.open(opt.getAttribute("ref"),"_blank");
		}else if(opt.value.substring(0,5).toLowerCase() == "https"){
			signup(opt.value,opt.getAttribute("mode"));			
		}else{
			if(opt.value != "0"){
				launchApp(opt.value,opt.getAttribute("mode"));
			}	
		}
		s.selectedIndex = 0;
	}
}
function quicklinkGo(opt){
	//var s = gid("quicklinksSelect");
	//var opt = s.options[s.selectedIndex];
	_hasGone = true;
	if(opt.getAttribute("ref")){ //gotopage
		window.open(opt.getAttribute("ref"),"_blank");
	}else if(opt.value.substring(0,5).toLowerCase() == "https"){
		signup(opt.value,opt.getAttribute("mode"));			
	}else{
		if(opt.value != "0"){
			launchApp(opt.value,opt.getAttribute("mode"));
		}	
	}
	
}
/*var values = ({
		action:action,
		csid:id,
		image1:gid("topimg"+id+"_1").firstChild.getAttribute("src"),
		image2:gid("topimg"+id+"_2").firstChild.getAttribute("src"),
		image3:gid("topimg"+id+"_3").firstChild.getAttribute("src"),
		title:tinyMCE.get("title"+id).getContent(),
		cname:gid("cname"+id).value
	});
	_currentid = id;
	var link = "/admin/addEditCustomerStorie";
	$.post(link,values,finishUpdate,"json");	*/
	
