
function DisableEnableForm(xForm,xHow){
  objElems = xForm.elements;
  for(i=0;i<objElems.length;i++){
  
    objElems[i].disabled = xHow;
  }
}

Effect.FadetoDim = function(element) {

if (document.getElementById('introduction'))
{ document.getElementById('introduction').style.display="none"; }

var oldOpacity = Element.getInlineOpacity(element);
var mainPage = document.getElementById(element);
  //mainPage.readOnly = true;
  
replaceAnchors(mainPage);

if (document.getElementById('test_search'))
DisableEnableForm(document.getElementById('test_search'),true);

DisableEnableForm(document.getElementById('formsearch'),true);
if (document.getElementById('registration_form'))
DisableEnableForm(document.getElementById('registration_form'),true);
if (document.getElementById('inectform'))
DisableEnableForm(document.getElementById('inectform'),true);
if (document.getElementById('test11'))
DisableEnableForm(document.getElementById('test11'),true);
if (document.getElementById('contact_us'))
DisableEnableForm(document.getElementById('contact_us'),true);
if (document.getElementById('expert_list'))
DisableEnableForm(document.getElementById('expert_list'),true);
if (document.getElementById('search_portal'))
DisableEnableForm(document.getElementById('search_portal'),true);


if (document.getElementById('submit_suggestion_form')){
DisableEnableForm(document.getElementById('submit_suggestion_form'),true);
Effect.Fade('suggested_expert',{duration:0.0});
}
if (document.getElementById('fff'))
Effect.Fade('fff',{duration:0.0});


if (document.getElementById('noqnty'))
Effect.Fade('noqnty',{duration:0.0});

if (document.getElementById('nobook'))
Effect.Fade('nobook',{duration:0.0});



  var options = Object.extend({
  from: Element.getOpacity(element) || 1.0,
  to:   0.2,
  afterFinishInternal: function(effect) { with(Element) { 
    if(effect.options.to!=0) return;
   
    hide(effect.element);
    setStyle(effect.element, {opacity: oldOpacity}); }}
  }, arguments[1] || {});
  return new Effect.Opacity(element,options);
 // DisableEnableLinks(true);
}


Effect.AppearBack = function(element) {
getBackLinks();
if (document.getElementById('introduction'))
Effect.Appear('introduction',{duration:0.0});

DisableEnableForm(document.getElementById('formsearch'),false);
if (document.getElementById('inectform'))
DisableEnableForm(document.getElementById('inectform'),false);
if (document.getElementById('test_search'))
DisableEnableForm(document.getElementById('test_search'),false);
if (document.getElementById('registration_form'))
DisableEnableForm(document.getElementById('registration_form'),false);
if (document.getElementById('test11'))
DisableEnableForm(document.getElementById('test11'),false);
if (document.getElementById('contact_us'))
DisableEnableForm(document.getElementById('contact_us'),false);
if (document.getElementById('submit_suggestion_form')){
DisableEnableForm(document.getElementById('submit_suggestion_form'),false);


Effect.Appear('suggested_expert',{duration:0.0});
}
if (document.getElementById('search_portal'))
DisableEnableForm(document.getElementById('search_portal'),false);
if (document.getElementById('expert_list'))
DisableEnableForm(document.getElementById('expert_list'),false);

  var options = Object.extend({
  from: (Element.getStyle(element, 'display') == 'none' ? 0.0 : Element.getOpacity(element) || 0.0),
  to:   1.0,
  beforeSetup: function(effect) { with(Element) {
    setOpacity(effect.element, effect.options.from);
    show(effect.element); }}
  }, arguments[1] || {});
  return new Effect.Opacity(element,options);
}



Effect.AppearToTransparent = function(element) {
  var options = Object.extend({
  from: (Element.getStyle(element, 'display') == 'none' ? 0.0 : Element.getOpacity(element) || 0.0),
  to:   0.7,
  beforeSetup: function(effect) { with(Element) {
    setOpacity(effect.element, effect.options.from);
    show(effect.element); }}
  }, arguments[1] || {});
  return new Effect.Opacity(element,options);
}

function replaceAnchors(section) {
	// initialize the Arrays
	

	links = new Array();
	linkTexts = new Array();
	parentOfLinks = new Array();
	
	linksI = new Array();
	linkTextsI = new Array();
	linksInput=new Array();
	
	spanI = new Array();
	spanTextsI = new Array();
	spanclass=new Array();
	
	
	// Get the section element
	divElement = section;
	//Get the image elements from the section element
	imagesI = divElement.getElementsByTagName("img");
	imglength=imagesI.length;
	//Change by nimisha for span issue
	spanI = divElement.getElementsByTagName("span");
	spanlength=spanI.length;
	
	inputI = divElement.getElementsByTagName("input");
	inplength=inputI.length;
	//Change by nimisha for span issue
	for (index=0;index < spanlength; index ++) {
	//Get the onclick attribute if any for span tag and store it in a temperory variable
		spanTextsI[index]=spanI[index].getAttribute('onclick');
	//Get class attribute if any for the span tag and store it in a temperory variable
	
		spanclass[index]=spanI[index].getAttribute('class');
		
		  
	//set the onclick attribute to null	
		spanI[index].setAttribute('onclick','');
	//set the class attribute to null other	han photostyle class
	
		 	spanI[index].style.cursor="default";
	}	
	
	
	//Loop through the image tags
	for (index=0;index < imglength; index ++) {
	//Get the onclick attribute if any for image tag and store it in a temperory variable
		linkTextsI[index]=imagesI[index].getAttribute('onclick');
	//Get class attribute if any for the image tag and store it in a temperory variable
		linksI[index]=imagesI[index].getAttribute('class');
		
		  
	//set the onclick attribute to null	
		imagesI[index].setAttribute('onclick','');
	//set the class attribute to null other	han photostyle class
		if (imagesI[index].getAttribute('class')!="photostyle")
		 	imagesI[index].style.cursor="default";
		
		//imagesI[index].setAttribute('class','');
		
		
		//imagesI[index].setAttribute('class','');
	}
	
	// Get all the Anchor elements

for (index=0;index < inplength; index ++) {
		if (inputI[index].getAttribute('type')=="image"){
				inputI[index].disabled=true;
				inputI[index].style.cursor="default";
		}
		if (inputI[index].getAttribute('type')=="button"){
				inputI[index].style.cursor="default";
		}
}



	anchors = divElement.getElementsByTagName("a");
	
	noOfAnchors = anchors.length;
	
	
	//Loop through the anchors

	for (index=0;index < noOfAnchors; index ++) {
	
		/*
		 * OK here some explanation is needed.  Whenever an anchor is replaced with a text
		 * the DOM structure is changed, so the next available anchor will be in the zero'th
		 * position, thats why you see anchors[0] being used. Got it?
		 */
		
		
		// Store the link element for later replacement. Clone and get it so
		// it is not a reference but a copy
		
		links[index] = anchors[0].cloneNode(true);
		
		parentOfLinks[index] = anchors[0].parentNode;
		// Take a copy of the child element of anchor
		linkTexts[index] = anchors[0].childNodes[0];
		
		//Replace the anchor with a text node
	
		parentOfLinks[index].replaceChild(linkTexts[index], anchors[0]);
		
	
	}
	
}

/*
 * This function restores back all the anchors using the stored information
 */
function getBackLinks() {
//Loop through the anchor links and replace the text with anchors
	for(index = 0; index < links.length; index++) {
		parentOfLinks[index].replaceChild(links[index], linkTexts[index]);
	}
	//Change by nimisha for span issue
	//Loop through the span tag and replace the onclick function 
	for (index=0;index < spanTextsI.length; index ++) {
		spanI[index].setAttribute('onclick',spanTextsI[index]);
	}
	
	//Loop through the span tag and replace the class attribute
	for (index=0;index < spanI.length; index ++) {
		spanI[index].setAttribute('class',spanclass[index]);
		if (spanI[index].getAttribute('class')=="expsearch"){
		spanI[index].style.cursor="hand";
		spanI[index].style.cursor="pointer";
	}
		
	}
//Loop through the images tag and replace the onclick function 
	for (index=0;index < linkTextsI.length; index ++) {
		imagesI[index].setAttribute('onclick',linkTextsI[index]);
	}
//Loop through the images tag and replace the class attribute
	for (index=0;index < linksI.length; index ++) {
		imagesI[index].setAttribute('class',linksI[index]);
		if (imagesI[index].getAttribute('class')=="shop")
		imagesI[index].style.cursor="hand";
		imagesI[index].style.cursor="pointer";
	}
	for (index=0;index < inplength; index ++) {
		if (inputI[index].getAttribute('type')=="image"){
				inputI[index].disabled=false;
				inputI[index].style.cursor="hand";
				inputI[index].style.cursor="pointer";
		}
		if (inputI[index].getAttribute('type')=="button"){
				inputI[index].style.cursor="hand";
				inputI[index].style.cursor="pointer";
		}
}
		
}
