function cp(imgID){
	try{
		if (document.images["img" + imgID] && eval("img" + imgID + "Over.src")){
			document.images["img" + imgID].src=eval("img" + imgID + "Over.src");
		}
	}catch(er) {
	}
}

function cp2(imgID){
	try{
		if (document.images["img" + imgID] && eval("img" + imgID + ".src")){
			document.images["img" + imgID].src=eval("img" + imgID + ".src");
		}
	}catch(er) {
	}
}

function CP(imgID, Level){
	try{
		if (document.images["img" + imgID] && eval("imgL" + Level + "Over.src")){
			document.images["img" + imgID].src=eval("imgL" + Level + "Over.src");
		}
	}catch(er) {
	}
}

function CP2(imgID, Level){
	try{
		if (document.images["img" + imgID] && eval("imgL" + Level + ".src")){
			document.images["img" + imgID].src=eval("imgL" + Level + ".src");
		}
	}catch(er) {
	}
}

function SetContentHeight(){ //Enables
	DwTopGraphicHeight = 0;
	if(document.getElementById("DwTopGraphic")){
		if(document.getElementById("DwTopGraphic").length){
			for(var iDT = 0; iDT < document.getElementById("DwTopGraphic").length; iDT++){
				DwTopGraphicHeight += document.getElementById("DwTopGraphic")[iDT].offsetHeight;
			}
		}
		else{
			DwTopGraphicHeight += document.getElementById("DwTopGraphic").offsetHeight;
		}
	}

	DwFooterHeight = 0;
	if(document.getElementById("DwFooter")){
		if(document.getElementById("DwFooter").length){
			for(var iDT = 0; iDT < document.getElementById("DwFooter").length; iDT++){
				DwFooterHeight += document.getElementById("DwFooter")[iDT].offsetHeight;
			}
		}
		else{
			DwFooterHeight += document.getElementById("DwFooter").offsetHeight;
		}
	}

	if(document.getElementById("DwContentCell")){
		document.getElementById("DwContentCell").style.overflow = "auto";
		height = document.body.clientHeight - DwFooterHeight - DwTopGraphicHeight; //- 15
		document.getElementById("DwContentCell").style.height = height;
	}
}

function isRadioButtonChecked(theOption, theForm){ 
	if (theForm.elements[theOption].checked){
		return true;
	}
	else{
		for (i=0;i < theForm.elements[theOption].length;i++) {
			if (theForm.elements[theOption][i].checked) {
				return true;
			}
		}
	}
	return false;
}

function validateEmail( email ){
  var regExp = /^[\w\-_]+(\.[\w\-_]+)*@[\w\-_]+(\.[\w\-_]+)*\.[a-z]{2,4}$/i;
  return regExp.test( email );
}


function changeCardImage(dir){
	//document.EcardForm.ECardImage.src = dir + '/' + document.EcardForm.AttachImage.value;
	//Changed for both Forefox and IE7 compatibility
	document.getElementsByName('ECardImage')[0].src = dir + '/' + document.getElementsByName('AttachImage')[0].value;
}

function CookieTest() {
	document.cookie = 'test';
	if(document.getElementById('favorites')){
		if (document.cookie == "") {
			document.getElementById('favorites').style.display = 'none';
		}
		else {
			document.getElementById('favorites').style.display = 'block';
		}
	}
}

//Ecom
function popUp(url, name, w, h, extra){
	str="height="+h+",width="+w+","+extra;
	if(parseInt(navigator.appVersion)>3){
		str+=",left="+(screen.width -w)/2+",top="+parseInt((screen.height -h)/2);
	}

	window.open(url,name,str);
}

function Zoom(pic){ 
	if (document.images) {
		popUp('/admin/public/ShowTemplate.aspx?Template=ecom/ViewImage.html&Image='+pic, '_blank',450,350,'resizable=1,scrollbars=1');
	}
}
