<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
  newWindow = window.open(theURL,winName,features);
  newWindow.focus();
}
//-->
function change(e, color){
var el=window.event? event.srcElement: e.target
if (el.tagName=="INPUT")
el.style.backgroundColor=color
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function cOn(td){
if(document.getElementById||(document.all && !(document.getElementById))){
td.style.backgroundColor="#BBD067";
}
}
function cOut(td){
if(document.getElementById||(document.all && !(document.getElementById))){
td.style.backgroundColor="#F4FFCA";
}
}
function bOn(td){
if(document.getElementById||(document.all && !(document.getElementById))){
td.style.backgroundColor="#78b0cb";
}
}
function bOut(td){
if(document.getElementById||(document.all && !(document.getElementById))){
td.style.backgroundColor="#E1F3F9";
}
}
function pOn(td){
if(document.getElementById||(document.all && !(document.getElementById))){
td.style.backgroundColor="#F9CBDF";
}
}
function pOut(td){
if(document.getElementById||(document.all && !(document.getElementById))){
td.style.backgroundColor="#FFF0F6";
}
}
function oOn(td){
if(document.getElementById||(document.all && !(document.getElementById))){
td.style.backgroundColor="#ffffff";
}
}
function oOut(td){
if(document.getElementById||(document.all && !(document.getElementById))){
td.style.backgroundColor="#d8d8d0";
}
}
function hOn(td){
if(document.getElementById||(document.all && !(document.getElementById))){
td.style.backgroundColor="#89AA00";
}
}
function hOut(td){
if(document.getElementById||(document.all && !(document.getElementById))){
td.style.backgroundColor="#999999";
}
}
function bidOn(td){
if(document.getElementById||(document.all && !(document.getElementById))){
td.style.backgroundColor="#BBD067";
}
}
function bidOut(td){
if(document.getElementById||(document.all && !(document.getElementById))){
td.style.backgroundColor="#89AA00";
}
}
function offOn(td){
if(document.getElementById||(document.all && !(document.getElementById))){
td.style.backgroundColor="#78B0CB";
}
}
function offOut(td){
if(document.getElementById||(document.all && !(document.getElementById))){
td.style.backgroundColor="#00649A";
}
}
function comOn(td){
if(document.getElementById||(document.all && !(document.getElementById))){
td.style.backgroundColor="#F3D2E0";
}
}
function comOut(td){
if(document.getElementById||(document.all && !(document.getElementById))){
td.style.backgroundColor="#FAEADA";
}
}
function pinkOn(td){
if(document.getElementById||(document.all && !(document.getElementById))){
td.style.backgroundColor="#89aa00";
}
}
function pinkOut(td){
if(document.getElementById||(document.all && !(document.getElementById))){
td.style.backgroundColor="#86002f";
}
}
function tabOn(td){
if(document.getElementById||(document.all && !(document.getElementById))){
td.style.backgroundColor="#e5e5e5";
}
}
function tabOut(td){
if(document.getElementById||(document.all && !(document.getElementById))){
td.style.backgroundColor="#d8d8d0";
}
}
function abc1()
{
if (window.document.frm1.btn1.click)
	{		
		window.document.frm1.target="_parent";
		window.document.frm1.action="../livex_results.jsp";
		window.document.frm1.submit();
	}	
}	
	
function abc2()
{	
if (window.document.frm1.btn2.click)
	{			
		window.document.frm1.target="_parent";
		window.document.frm1.action="#";
		window.document.frm1.submit();
	}	
}

function abc3()
{	
if (window.document.frm2.btn3.click || window.document.frm2.btn4.click || window.document.frm2.btn5.click)
	{			
		window.document.frm2.target="_parent";
		window.document.frm2.action="../livex_contract_details.jsp";
		window.document.frm2.submit();
	}
}

function abc4()
{	
if (window.document.frm2.btn4.click)
	{	
		window.document.frm2.target="_parent";
		window.document.frm2.action="a4.htm";
		window.document.frm2.submit();
	}	
}

function abc5()
{	
if (window.document.frm3.btn5.click)
	{			
		window.document.frm3.target="_parent";
		window.document.frm3.action="livex_confirm_order.jsp";
		window.document.frm3.submit();
	}	
}

function abc6()
{	
if (window.document.frm3.btn6.click)
	{			
		window.document.frm3.target="_parent";
		window.document.frm3.action="livex_summary_info.jsp";
		window.document.frm3.submit();
	}	
}

function abc7()
{	
if (window.document.frm4.btn7.click)
	{			
		window.document.frm4.target="_parent";
		window.document.frm4.action="livex_summary_info.jsp";
		window.document.frm4.submit();
	}	
}
function abc8()
{	
if (window.document.frm5.btn8.click || window.document.frm5.btn9.click || window.document.frm5.btn10.click)
	{			
		window.document.frm5.target="_parent";
		window.document.frm5.action="../livex_myaccount_bidoffers_confirmchanges.jsp";
		window.document.frm5.submit();
	}
}
function abc9()
{	
if (window.document.frm6.btn11.click)
	{			
		window.document.frm6.target="_parent";
		window.document.frm6.action="livex_myaccount_bidoffers.jsp";
		window.document.frm6.submit();
	}	
}
function abc10()
{	
if (window.document.frm7.btn12.click)
	{			
		window.document.frm7.target="_parent";
		window.document.frm7.action="index.jsp";
		window.document.frm7.submit();
	}	
}
function addcellar()
{	
if (window.document.frmcellar.addcel.click)
	{			
		window.document.frmcellar.target="_parent";
		window.document.frmcellar.action="../myaccount_cellar_buildwizard.jsp";
		window.document.frmcellar.submit();
	}	
}

function tabnavOn(td){
if(document.getElementById||(document.all && !(document.getElementById))){
td.style.backgroundColor="#89AA00";
}
}
function tabnavOut(td){
if(document.getElementById||(document.all && !(document.getElementById))){
td.style.backgroundColor="#999999";
}
}


function printPage(serverRoot){
print_Page(serverRoot, "pc")
}

function print_Page(serverRoot, printDivId)
{ 
  var disp_setting="toolbar=no,location=no,directories=no,menubar=no,"; 
      disp_setting+="resizable=yes,scrollbars=yes,width=630, height=500, left=190, top=145"; 
 var content_vlue = document.getElementById(printDivId).innerHTML; 
  var docprint=window.open("","",disp_setting); 
   docprint.document.open(); 
   docprint.document.write('<html><head><title>Liv-ex Print</title>'); 
   docprint.document.write('<base href="'+serverRoot+'/">');
   docprint.document.write('<link href="css/main.css" rel="stylesheet" type="text/css">');
   docprint.document.write('</head><body onLoad="self.print()">');
   
   docprint.document.write('<table width="100%" border="0" cellpadding="0" cellspacing="0">');  
  docprint.document.write('<tr>');  
    docprint.document.write('<td align="right"><img src="images/livex_logo.gif" width="92" height="30"></td>');  
  docprint.document.write('</tr>');  
  docprint.document.write('<tr>');  
    docprint.document.write('<td>');             
   docprint.document.write(content_vlue);
   docprint.document.write('</td>');
  docprint.document.write('</tr>');  
  docprint.document.write('<tr>');  
    docprint.document.write('<td></td>');  
  docprint.document.write('</tr>');  
  docprint.document.write('<tr>');  
    docprint.document.write('<td class="table-header">Liv-ex.com</td>');  
  docprint.document.write('</tr>');  
  docprint.document.write('<tr>');  
    docprint.document.write('<td bgcolor="#CCCCCC"><img src="images/spacer.gif" width="8" height="1"></td>');  
  docprint.document.write('</tr>');  
  docprint.document.write('<tr>');  
    docprint.document.write("<td>Printed from Liv-ex.com, the Fine Wine Exchange. <BR>Liv-ex is an electronic trading and information platform for fine wine merchants. Liv-ex's unrivalled pricing information and cellar tracking tools are also available to fine wine enthusiasts and collectors. To find out more about the services please visit <a href=\"#\" class=\"main-link\">www.liv-ex.com</a>.</td>");  
  docprint.document.write('</tr>');  
docprint.document.write('</table>');  
            
   docprint.document.write('</body></html>'); 
   docprint.document.close(); 
   docprint.focus(); 
}



function persistOrderpad(document, orderpadForm,orderPadSize,serverInitial,exMgrPrev) {
	  //alert("Hello::::::::;;;"+document);
	  //alert("orderpadForm"+orderpadForm);
	 try {
	if(orderPadSize > 0 )
  	{
  	     var tempArr = new Array();
		 if(orderPadSize ==1){
			 tempArr[0] =orderpadForm.keyArr;
		 }else{
			  tempArr =orderpadForm.keyArr;
		 }
  		//orderpadForm = window.document.frm2;
  		for(var i=0; i<tempArr.length; i++) {
  			//alert("orderpad " + (i+1));
  			var merchant = "-";
  			var vin = "";
  			var size = "";
  			var units = "";
  			var price = "";
  			var contract = "";
  			var contractStatus="";
            var forexValue = "";
            var rate = "";
            var tradeCurrency = "";
            var curPerBottle = "";
  				if(exMgrPrev==1){
  				    var mid = "merchantName"+tempArr[i].value;
  				    if(document.getElementById(mid) != null){
  						merchant = document.getElementById(mid).value; 
  					} 	
  				}
  							
  			
  						
  			//alert(merchant);
  			var vinField = "vintage"+tempArr[i].value;
			//alert("Hello::::::::;;;"+document.getElementById(vinField));
  			if(document.getElementById(vinField) != null) {  			
  				vin = document.getElementById(vinField).value;
  			}
  			//alert("vin: " + vin);
  			var sizeField = "size"+tempArr[i].value;
  			if(document.getElementById(sizeField) != null) {  			
  				size = document.getElementById(sizeField).value;
  			}
  			//alert("size: " + size);
  			var unitField = "units"+tempArr[i].value;
  			if(document.getElementById(unitField) != null) {  			
  				units = document.getElementById(unitField).value;
  			}
  			//alert("units: " + units);
  			var priceField = "ammount"+tempArr[i].value;
  			if(document.getElementById(priceField) != null) {  			
  				price = document.getElementById(priceField).value;
  			}
  			//alert("price: " + price);
  			var contractField = "contractType"+tempArr[i].value;
  			if(document.getElementById(contractField) != null) {  			
  				contract = document.getElementById(contractField).value;
  			}
  			var orderState = "orderState"+tempArr[i].value;
  			if(document.getElementById(orderState) != null) {   				
  				contractStatus = document.getElementById(orderState).value;	
  			}
           
            var forexField = "forexValueVal"+tempArr[i].value;
            if(document.getElementById(forexField) != null) {              
             forexValue = document.getElementById(forexField).value; 
            }
            var rateField = "rateVal"+tempArr[i].value;
            if(document.getElementById(rateField) != null) {              
             rate = document.getElementById(rateField).value; 
            }
            
            var tradeCurrField = "tradeCurrency"+tempArr[i].value;
            if(document.getElementById(tradeCurrField) != null) {              
             tradeCurrency = document.getElementById(tradeCurrField).value; 
            }
            
            var curPerBottleField = "curPerBottle"+tempArr[i].value;
            if(document.getElementById(curPerBottleField) != null) {              
             curPerBottle = document.getElementById(curPerBottleField).value; 
            }
            //alert("contract: " + contract);
  			setOPValues(tempArr[i].value, merchant, vin, size, units, price, contract, contractStatus,serverInitial, forexValue, rate, tradeCurrency, curPerBottle);
  		}
  	}
  	}catch(err) {
  		
  	}
  }
  
  	var http_request_optrade = false; 
	var tradeCounter = 0;
	function setOPValues(index, merchant, vin, size, units, price, contract, contractStatus,serverInitial, forexValue, rate,  tradeCurrency, curPerBottle) {
		try {
			var url = '/include/order_pad_persist.jsp?index='+index+'&merchant='+merchant+'&vin='+vin+'&size='+size+'&units='+units+'&price='+price+'&contract='+contract+'&contractStatus='+contractStatus+'&forexValue='+forexValue+'&rate='+rate+'&tradeCurrency='+tradeCurrency+'&curPerBottle='+curPerBottle;
			
            if (window.XMLHttpRequest) { // Mozilla, Opera, ...
			    http_request_optrade = new XMLHttpRequest();
			} else if (window.ActiveXObject) { // IE
			    http_request_optrade = new ActiveXObject("Microsoft.XMLHTTP");
			}		 
			http_request_optrade.onreadystatechange = ajaxOPTradeResponse;
			http_request_optrade.open("GET", url, false);
			http_request_optrade.send("test");
		} catch(err) {
			
		}
	}
		
	function ajaxOPTradeResponse() {
		try {
			if(window.http_request_optrade === undefined) {
				//alert("http_request_optrade is not defined");
			} else {
				if (http_request_optrade.readyState == 4) {
				   if (http_request_optrade.status == 200) {
					var data = http_request_optrade.responseText;
					//alert(data);
					//document.getElementById("recTr").innerHTML = data;
					//tradeCounter += 1;
				   } 
				} 
			}
		} catch(err) {
		}
					
	}
	
	function Trim(TRIM_VALUE){
if(TRIM_VALUE.length < 1){
return"";
}
TRIM_VALUE = RTrim(TRIM_VALUE);
TRIM_VALUE = LTrim(TRIM_VALUE);
if(TRIM_VALUE==""){
return "";
}
else{
return TRIM_VALUE;
}
} //End Function

function RTrim(VALUE){
var w_space = String.fromCharCode(32);
var v_length = VALUE.length;
var strTemp = "";
if(v_length < 0){
return"";
}
var iTemp = v_length -1;

while(iTemp > -1){
if(VALUE.charAt(iTemp) == w_space){
}
else{
strTemp = VALUE.substring(0,iTemp +1);
break;
}
iTemp = iTemp-1;

} //End While
return strTemp;

} //End Function

function LTrim(VALUE){
var w_space = String.fromCharCode(32);
if(v_length < 1){
return"";
}
var v_length = VALUE.length;
var strTemp = "";

var iTemp = 0;

while(iTemp < v_length){
if(VALUE.charAt(iTemp) == w_space){
}
else{
strTemp = VALUE.substring(iTemp,v_length);
break;
}
iTemp = iTemp + 1;
} //End While
return strTemp;
}


/*
Use to update the set the update the width of the menu
*/

function setMenuSize(navigator, menuNo, menuWidthStyle, menuLineStyle) {
	if(navigator.vendor == "Apple Computer, Inc."
	    || navigator.vendor == "Google Inc.") {
		mnbarWidth = ((window.innerWidth - 387) / menuNo );
		menuWidthStyle.itemwidth = Math.round(mnbarWidth);
		menuLineStyle.itemwidth = Math.round(mnbarWidth);
	}
}
/*
This method will be used to activate flash control automatically.
*/

function writeFlash(id, curr, url) {
	document.getElementById(id).innerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" position: relative style="z-index:-9999; codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="160" height="192"><param name="movie" value="../ticker/most-recent-trades.swf"><param name="quality" value="high" /><param name="AllowScriptAccess" value="always"/><param name="wmode" value="transparent" /><param name="quality" value="high"><param name="FlashVars" value="Curr='+curr+'&webSerUrl='+url+'/services/RecentTradeService?wsdl" /><embed src="../ticker/most-recent-trades.swf" FlashVars="Curr='+curr+'&webSerUrl='+url+'/services/RecentTradeService?wsdl" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode = "transparent" width="180" height="225"></embed></object>';
} 



//var currenttime;
var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","July","Aug","Sep","Oct","Nov","Dec");
var serverdate;
function padlength(what){
	var output=(what.toString().length==1)? "0"+what : what
	return output
}

function displaytime(obj){
	serverdate.setSeconds(serverdate.getSeconds()+1)
	var datestring=serverdate.getDate()+" "+montharray[serverdate.getMonth()]+" "+serverdate.getFullYear()
	var timestring=padlength(serverdate.getHours())+":"+padlength(serverdate.getMinutes())
	obj.innerHTML=datestring+"&nbsp;&nbsp;&nbsp;"+timestring+"&nbsp;(UK)"
}


var http_request_switchUser = false;
var switchUsrId;

function switchUser(orderTBC, orderTBP) {
	var switchUser = true;
	switchUsrDD = document.getElementById("switchUserId");
	switchUsrId = switchUsrDD.options[switchUsrDD.selectedIndex].value;
	//switchUserFrm = document.getElementById("frmSwUser");
	//curAddHdFld = document.getElementById("curAdd");
	//curAddHdFld.value = window.location;
	//switchUsrHdFld = document.getElementById("hdSwitchUserId");
	//switchUsrHdFld.value=switchUsrId;
	//switchUserFrm.action = "/portal/template/livex_home.vm/action/LoginAction/eventsubmit_doswitchuser/doSwitchuser";
	//switchUserFrm.submit();
	
	
	var ajaxurl = '/include/checkOrderPresent.jsp';
	if (window.XMLHttpRequest) { // Mozilla, Opera, ...
	    http_request_switchUser = new XMLHttpRequest();
	} else if (window.ActiveXObject) { // IE
	    http_request_switchUser = new ActiveXObject("Microsoft.XMLHTTP");
	}		 
	http_request_switchUser.onreadystatechange = ajaxOrderPresentStatusRes;
	http_request_switchUser.open("POST", ajaxurl, true);
	http_request_switchUser.send("test");
}

function ajaxOrderPresentStatusRes() {
	        
	if (http_request_switchUser.readyState == 4) {
		if (http_request_switchUser.status == 200) {
			var data = http_request_switchUser.responseText;
			//alert("*"+data+"*" + switchUsrId);
			var switchUser = true;
			if(data == 'true') {
				if(!confirm('Changing accounts will clear all unconfirmed orders. Do you want to proceed?')){
					switchUser = false;
				}
			}
			if(switchUser == true) {
				window.location = "/portal/template/livex_home.vm/action/LoginAction/eventsubmit_doswitchuser/doSwitchuser?hdSwitchUserId="+switchUsrId+"&curAdd="+window.location;
			}
		} 
	}
}

function ajaxSession() {
	var http_request_session = false;
	var ajaxurl = '/getDateFromLong.jsp';
	if (window.XMLHttpRequest) { // Mozilla, Opera, ...
	    http_request_session = new XMLHttpRequest();
	} else if (window.ActiveXObject) { // IE
	    http_request_session = new ActiveXObject("Microsoft.XMLHTTP");
	}
	http_request_session.onreadystatechange = ajaxSessionRes;
	http_request_session.open("POST", ajaxurl, true);
	http_request_session.send("test");
}

function ajaxSessionRes() {
	//alert("dddd");
}

function callAxjaxSession() {
	//alert("hi----");
	ajaxSession();
	setTimeout(callAxjaxSession, 1500000);
}
/**
Function used to update the innerhtml for the given div
**/
function divUpdater(divId, ajaxUrl, msg){
   if(document.getElementById(divId)) {
      document.getElementById(divId).innerHTML = '<table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center"  height="100"><a href="javascript:void(0)" class="main-link">Loading ...</a></td></tr></table>';
      
      	new Ajax (ajaxUrl, {
                onComplete: function (responseText, responseXML) {
                                document.getElementById(divId).innerHTML = responseText;
                },
                onFailure: function () {
                                if(msg === undefined) {
                                  document.getElementById(divId).innerHTML = "Oops there is some problem to fetch the data";
                                } else {
                                  document.getElementById(divId).innerHTML = msg;  
                                }
                },
                method: 'get'
   		}).request();
   }
   
}



	function chkYr(obj){
		var firstPart ="";
		var secPart ="";
		var val = Trim(obj.value);
		var tempVal = val.substring(val.lastIndexOf("/")+1);
		firstPart = val.substring(0,val.indexOf("/"));
		if(firstPart.length == 1){
			firstPart = "0"+firstPart;
		}
		secPart = val.substring(val.indexOf("/")+1,val.lastIndexOf("/"));
		if(secPart.length == 1){
			secPart = "0"+secPart;
		}
		if(!isNaN(tempVal)){
		    if(!tempVal=="" && tempVal.length==2){
				if(tempVal > 20 ){
					var newVal = "19"+tempVal;
					obj.value = firstPart+"/"+secPart+"/"+newVal;
				}
				else{
					var newVal = "20"+tempVal;
					obj.value = firstPart+"/"+secPart+"/"+newVal;
				}
			}
		}
	}
	
	/**
	 * This method will be used to show currency alert on  new orders.
	 */
	function showForexWarnPopup(wineCode, isAgainstOffer, isEm, merchantId, tradeCurr){
		var url ='/portal/template/add_exchange_rt_pad.vm/action/LivexInitializeBidandOfferAction/eventsubmit_doaddlist/doAddlist/wineCode/'+wineCode+'/isAgainstOffer/'+isAgainstOffer;
		var popupURL ='/jsp/forex_price_warning_popup.jsp?wineCode='+wineCode+'&isAgainstOffer='+isAgainstOffer;
  		
  		if(!isEm){
  			var respnseVal = getTradeCurFeedStatus(merchantId);
  			if(respnseVal == 'true'){
				popupURL = popupURL+'&feedFailed='+respnseVal;
				javascript:MM_openBrWindow(popupURL,'msgWin','width=300,height=150');
			}else if((document.getElementById("currencyBox") 
						&&  document.getElementById("currencyBox") != 'undefined') 
						&& document.getElementById("currencyBox").value != tradeCurr){
				javascript:MM_openBrWindow(popupURL,'msgWin','width=300,height=150');
			}else {
				dispOrderPad(url);
			}
  		}else {
  			dispOrderPad(url);
  		}	
	}
	
	/**
	 * This method will be used to show currency alert on edit orders.
	 */
	function showForexWarnPopupEdit(wineCode, contractId, isEm, merchantId){
		var url ='/portal/template/add_exchange_rt_pad.vm/action/LivexInitializeBidandOfferAction/eventsubmit_doAddtoeditlist/doAddtoeditlist/wineCode/'+wineCode+'/contractId/'+contractId;
		var popupURL ='/jsp/forex_price_warning_popup.jsp?wineCode='+wineCode+'&contractId='+contractId;
  		
  		var respnseVal = getTradeCurFeedStatus(merchantId);
		if(respnseVal == 'true'){
			popupURL = popupURL+'&feedFailed='+respnseVal+'&isEdit=true';
			javascript:MM_openBrWindow(popupURL,'msgWin','width=300,height=150');
		}else {
			dispOrderPad(url);
		}
  		
	}
  
  
  function dispOrderPad(url){
  			try{
				rightR.location =url;
			}catch(err) {
				right.location =url;
			}
  }

  var http_request_mer_trd_curr_chk = false;

  function getTradeCurFeedStatus(merchantId) {
    		var ajaxUrl ='/ajaxresp/check_mer_trd_curr.jsp?merchantId='+merchantId;
            if (window.XMLHttpRequest) { // Mozilla, Opera, ...
    		    http_request_mer_trd_curr_chk = new XMLHttpRequest();
    		} else if (window.ActiveXObject) { // IE
    		    http_request_mer_trd_curr_chk = new ActiveXObject("Microsoft.XMLHTTP");
    		}
    		http_request_mer_trd_curr_chk.onreadystatechange = ajaxTradeCurFeedStatusResponse;
    		http_request_mer_trd_curr_chk.open("POST", ajaxUrl, false);
    		http_request_mer_trd_curr_chk.send("test");
    		return http_request_mer_trd_curr_chk.responseText;
  }


  function ajaxTradeCurFeedStatusResponse(){
	  if (http_request_mer_trd_curr_chk.readyState == 4) {
        		if (http_request_mer_trd_curr_chk.status == 200) {
					return http_request_mer_trd_curr_chk.responseText;
				}
	  }	
  }
  
  
  function chkVinYear(obj)
	{
		var val = Trim(obj.value);
		
		if(!isNaN(val))
		{
			if(!val=="" && val.length==2)
			{
				if(val > 20 )
				{
					var newVal = "19"+val;
					obj.value = newVal;
				}
				else
				{
					var newVal = "20"+val;
					obj.value = newVal;
				}
			}
		}
	}
	
	
	 function hideImage(){
	   var obj = document.getElementsByName('pic');
	   if(obj){
	   	 for(i =0; i<obj.length; i++){
	   	 	document.getElementsByName("pic")[i].style.display="none";
	   	 }
	   }
	   document.getElementById("hdPhoto").innerHTML="Show Photo";
	   document.getElementById("hdPhoto").href="javascript:openImage()";
	}

	function openImage(){
		 var obj = document.getElementsByName('pic');
		 if(obj){
		   	 for(i =0; i<obj.length; i++){
		   	 	document.getElementsByName("pic")[i].style.display="inline";
		   	 }
	   	 }
		   
	     document.getElementById("hdPhoto").innerHTML="Hide Photo";
	     document.getElementById("hdPhoto").href="javascript:hideImage()";
	}
	
	// Method will return whether any data has changed in the form since page load
	function isDataChanged(form) {
                var dataChanged = false;
                var fieldType;
                var indicator = false;

                for(i=0 ; i<form.length ; i++){
                    fieldType = form.elements[i].type;
                    if(fieldType=="text" || fieldType=="textarea"){
                        if(!(form.elements[i].defaultValue == form.elements[i].value)){
                            indicator=true;
                            break;
                        }
                                                    
                    } else if(fieldType=="checkbox" || fieldType=="radio"){
                        if(!(form.elements[i].defaultChecked == form.elements[i].checked)){
                            indicator=true;
                            break;
                        }
                    } else if(fieldType == "combo" || fieldType == "list" || fieldType == "select-one" || fieldType == "select-multiple"){
                                    var optionsLength = form.elements[i].options.length;
                                    if(optionsLength > 1) {
                                        //Check if the DDL contains any option as selected by Default
                                        var defaultSelectedFlag = false;
                                        for(k=0;k<optionsLength;k++){
                                            if(form.elements[i].options[k].defaultSelected)
                                                defaultSelectedFlag = true;
                                        }
                                        //If one of the options was selected by Default
                                        if(defaultSelectedFlag) {
                                            for(k=0 ; k<optionsLength ; k++){
                                                            if(!(form.elements[i].options[k].defaultSelected == form.elements[i].options[k].selected)){                                                                                                                                                                               
                                                                indicator=true;
                                                                break;                                                                                   
                                                            }                                                                                              
                                            }
                                        } else {
                                            //If one of the options was not selected by Default and option other than first is selected. Then it means the data has changed.
                                            for(k=1 ; k<optionsLength ; k++){
                                                if(form.elements[i].options[k].selected){                                                                                                                                                                            
                                                    indicator=true;
                                                    break;                                                                                   
                                                }                                                                                              
                                            }
                                        }
                                    }
                    }
                }
                return indicator;
		}
	
  
