//<!--
	//	Declarations
	var hidePn = true;
//	var isMediaPlayerExist = false;
//	var isRealPlayerExist = false;
	var imgFileClick = 0;
	var imgFileValue = "";
	var tt = null;

	var audFileClick = 0;
	var audFileValue = "";

	var audioExt = new Array();
	var videoExt = new Array();
	var imageExt = new Array();
	var mediaExt = new Array();
	var realExt = new Array();
	var isAudioAttached = false;
	var isVideoAttached = false;
	var isImageAttached = false;
	var displayLeft = 0;
	var displayTop = 0;
	var displayWidth = 0;
	var displayHeight = 0;
	var popupHandler = null;
	var previewWindow = null;

	var displayScreenWidth = 0;
	var displayScreenHeight = 0;

	function round_decimals(original_number, decimals) {
		var result1 = original_number * Math.pow(10, decimals)
		var result2 = Math.round(result1)
		var result3 = result2 / Math.pow(10, decimals)
		return pad_with_zeros(result3, decimals)
	}

	function pad_with_zeros(rounded_value, decimal_places) {
		// Convert the number to a string
		var value_string = rounded_value.toString()
		// Locate the decimal point
		var decimal_location = value_string.indexOf(".")
		// Is there a decimal point?
		if (decimal_location == -1) {
			// If no, then all decimal places will be padded with 0s
			decimal_part_length = 0
			// If decimal_places is greater than zero, tack on a decimal point
			value_string += decimal_places > 0 ? "." : ""
		}
		else {
			// If yes, then only the extra decimal places will be padded with 0s
			decimal_part_length = value_string.length - decimal_location - 1
		}
		// Calculate the number of decimal places that need to be padded with 0s
		var pad_total = decimal_places - decimal_part_length
		if (pad_total > 0) {
			// Pad the string with 0s
			for (var counter = 1; counter <= pad_total; counter++) 
				value_string += "0"
			}
		return value_string
	}

	function imgFileOnClick(iFile){
		imgFileClick = 1;
		imgFileValue = iFile.value;
	}

	function imgFileFocus(iFile){
		if(imgFileClick == 1){
			if(imgFileValue != iFile.value){
				updateImgVid(iFile);
			}
		}
	}


	function audFileOnClick(iFile){
		audFileClick = 1;
		audFileValue = iFile.value;
	}

	function audFileFocus(iFile){
		if(audFileClick == 1){
			if(audFileValue != iFile.value){
				updateAud(iFile);
			}
		}
	}

	function findPosition( oLink ) {
		if( oLink.offsetParent ) {
			for( var posX = 0, posY = 0; oLink.offsetParent; oLink = oLink.offsetParent ) {
				posX += oLink.offsetLeft;
				posY += oLink.offsetTop;
			}
			return [ posX, posY ];
		} else {
			return [ oLink.x, oLink.y ];
		}
	}
	
	//	This function is used to position the calendar control
	function displayCal(){
		if (document.getElementById("dDate").checked == true){
			var pos = findPosition (document.getElementById("deliveryDate"));
			document.getElementById ("calFrm").style.left = pos[0];
			document.getElementById ("calFrm").style.top = eval (pos[1] + eval(22));
			document.getElementById ("calFrm").style.visibility = "visible";
			window.frames["calFrm"].displayDate(document.getElementById("deliveryDate"));
			//document.getElementById ("calFrm").document.displayDate(document.getElementById("deliveryDate"));
			//	populate calendar control
		}else{
			document.getElementById ("calFrm").style.visibility = "hidden";
		}
	}


	function showPhoneArea(){
		pos = (findPosition(document.getElementById("phone")));
		var left = eval(displayLeft + pos[0]);
		var top = eval(displayTop + pos[1]);
		var textContentHeight = round_decimals (eval( (((displayHeight-displayTop)/100)*20)), 0);
		
		document.getElementById("displayArea").style.left = left;
		document.getElementById("displayArea").style.top = top;
		document.getElementById("displayArea").style.width = eval(displayWidth-displayLeft);
		document.getElementById("displayArea").style.height = eval(displayHeight-displayTop);
		document.getElementById("TextContent").style.width = eval(displayWidth-displayLeft);
		document.getElementById("TextContent").style.height = textContentHeight;
		document.getElementById("mediaContent").style.height = eval((displayHeight-displayTop)-textContentHeight-20);
		displayScreenHeight = eval((displayHeight-displayTop)-textContentHeight-20);
		displayScreenWidth = eval(displayWidth-displayLeft);
		document.getElementById("displayArea").style.visibility = "visible";
		if(document.getElementById("slideImg")){
			document.getElementById("slideImg").style.visibility = "visible";
		}
	}

	function getPosition(imgObj){
		var textContentHeight = eval( (((displayHeight-displayTop)/100)*20));
		var height = eval((displayHeight-displayTop)-textContentHeight-20);
		var width = eval(displayWidth-displayLeft);
		var editImageWidth = eval(document.getElementById("editImageWidth").getAttribute("val"));
		var editImageHeight = eval(document.getElementById("editImageHeight").getAttribute("val"));		
		if (editImageHeight > height){
			//imgObj.style.height = height;
			imgObj.height = height;
		}else{
			imgObj.height = editImageHeight;
		}
		if (editImageWidth > width){
			//imgObj.style.width = width;
			imgObj.width = width;
		}else{
			imgObj.width = editImageWidth;
		}
		//imgObj.style.visibility = "visible";
	}

	function positionText(){

		if (is_explorer){
			if(document.getElementById("above").checked==true){
				if (document.getElementById("textItem").rowIndex != 1){
					document.getElementById("displayArea").moveRow(2,1);
				}
			}else{
				if (document.getElementById("textItem").rowIndex != 2){
					document.getElementById("displayArea").moveRow(1,2);
				}
			}
		}else{
			if(document.getElementById("above").checked==true){
				if (document.getElementById("textItem").rowIndex != 1){
					var secondRow = document.getElementById("displayArea").firstChild.childNodes[2];
					document.getElementById("displayArea").firstChild.removeChild(document.getElementById("displayArea").firstChild.childNodes[2]);
					document.getElementById("displayArea").firstChild.insertBefore(secondRow,document.getElementById("displayArea").firstChild.childNodes[1]);
				}
			}else{
				if (document.getElementById("textItem").rowIndex != 2){
					var secondRow = document.getElementById("displayArea").firstChild.childNodes[2];
					document.getElementById("displayArea").firstChild.removeChild(document.getElementById("displayArea").firstChild.childNodes[2]);
					document.getElementById("displayArea").firstChild.insertBefore(secondRow,document.getElementById("displayArea").firstChild.childNodes[1]);
				}
			}
		}
		document.getElementById("TextContent").focus();
	}

	function closeOpenedWindow(){
			try{
					previewWindow.close();

			}catch(e){

			}
			try{
					popupHandler.close();
			}catch(e){
			}

			try{
				document.getElementById("audioContent").innerHTML = "";
				document.getElementById("videoContent").innerHTML = "";
			}catch(e){
			}
	}


	function openWindow(source,type){
		if(previewWindow && !previewWindow.closed){
			previewWindow.close();
		}
		if(source=="public"){
			if (type==0){
				popupHandler = window.open('ViewPublicGallery.do?useraction=0&pageTraversing=0&isgallerypopup=1&popGalleryCategory=images','p_radio','directories=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=no,copyhistory=no,status=no,top=50,left=50,width=770,height=600');
				popupHandler.location = 'ViewPublicGallery.do?useraction=0&pageTraversing=0&isgallerypopup=1&popGalleryCategory=images';
			}else{
				popupHandler = window.open('ViewPublicGallery.do?useraction=0&pageTraversing=0&isgallerypopup=1&popGalleryCategory=audio','p_radio','directories=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=no,copyhistory=no,status=no,top=50,left=50,width=770,height=600');
				popupHandler.location = 'ViewPublicGallery.do?useraction=0&pageTraversing=0&isgallerypopup=1&popGalleryCategory=audio';
			}
			popupHandler.focus();
		}
		if(source=="private"){
			if(type==0){
				popupHandler = window.open('ViewPrivateGallery.do?useraction=0&pageTraversing=0&isgallerypopup=1&popGalleryCategory=images','p_radio','directories=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=no,copyhistory=no,status=no,top=50,left=50,width=770,height=600');
				popupHandler.location = 'ViewPrivateGallery.do?useraction=0&pageTraversing=0&isgallerypopup=1&popGalleryCategory=images';
			}else {
				popupHandler = window.open('ViewPrivateGallery.do?useraction=0&pageTraversing=0&isgallerypopup=1&popGalleryCategory=audio','p_radio','directories=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=no,copyhistory=no,status=no,top=50,left=50,width=770,height=600');
				popupHandler.location = 'ViewPrivateGallery.do?useraction=0&pageTraversing=0&isgallerypopup=1&popGalleryCategory=audio';
			}
			popupHandler.focus();
		}
	}

	function openPreviewWindow(url){
		if(document.getElementById("canSend").value=="true"){
			if (popupHandler && !popupHandler.closed){
				popupHandler.close();
			}
			//window.moveTo(0,0);
			//window.resizeTo(window.screen.width,window.screen.height);
			var width = window.screen.width;
			var height = window.screen.height;
			var displayLeft = eval((width-350)/2);
			var displayTop = eval (height-700);
			if(displayTop <= 0 ){
				displayTop = 100;
			}
			var parameter = "directories=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=no,copyhistory=no,status=no,top="+displayTop+",left="+displayLeft+",width=290,height=580";
			previewWindow = window.open(url,'p_radio',parameter);
			previewWindow.location = url;
			previewWindow.focus();
		}else{
			alert(document.getElementById("cantPreview").getAttribute("val"));
		}
	}

function openHelpPopup(url)
{
	var WindowObjectReference;
	WindowObjectReference = window.open(url,"WebtopHelp","left=200,top=85,scrollbars=yes,resizable=no,width=470,height=500");
}

//-->
