function clear_filter_list_loading_images(lists) {
    for (i=0; i<lists.length; i++) {
	document.getElementById(lists[i]+"_refresh").innerHTML = '<img src="../images/blank.gif"/>';
    }
    
}

function ajaxFilterLists(page, php_file, list, lists) {
    var xmlhttp = get_xmlhttp_object();
    var select;
    var list_answers = "";

    list_answers = "page="+page+"&list="+list;
    for (i=0; i<lists.length; i++) {
	if (list != lists[i]) {
	    document.getElementById(lists[i]+"_refresh").innerHTML = '<img src="../images/loader_small.gif"/>';
	}
	select = document.getElementById(lists[i]);
	if (select.selectedIndex >= 0) {
	    list_answers = list_answers + "&" + lists[i]+"="+select.options[select.selectedIndex].value;
	}
    }

    xmlhttp.onreadystatechange=function() {
	if(xmlhttp.readyState==4)	{
	    setTimeout(function(){clear_filter_list_loading_images(lists);lists=null}, 600);
	    //document.getElementById("output").innerHTML=xmlhttp.responseText;
	    var res = xmlhttp.responseText.split("::::");
	    for (i=0; i<res.length; i=i+2) {
		if (string_trim(res[i]).length > 0) {
		    //alert(res[i]);
		    document.getElementById(string_trim(res[i])).innerHTML=res[i+1];
		}
	    }
	}
    }

    var query = "../ajax/"+php_file+".php?"+list_answers;
    //alert(query);
    xmlhttp.open("get", query, true);
    xmlhttp.send(null);


}


function reset_selects(page, lists) {

    for (i=0; i<lists.length; i++) {
	if (document.getElementById(lists[i]).disabled == false) {
	    document.getElementById(lists[i]).value='Please Select';
	}
    }
    ajaxFilterLists(page, 'map_filter', 'clear', lists)

}


function get_xmlhttp_object() {
    var xmlhttp;
    if (window.XMLHttpRequest)  {
	// code for IE7+, Firefox, Chrome, Opera, Safari
	xmlhttp=new XMLHttpRequest();
    } else if (window.ActiveXObject) {
	// code for IE6, IE5
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    } else {
	alert("Your browser does not support XMLHTTP!");
    }
    return xmlhttp;
}

function string_trim(string) {
    return string.replace(/^\s+|\s+$/g, '');
}

function startUpload(q_id) {

    document.getElementById('upload_process_'+q_id).style.display = 'block';
    document.getElementById('upload_form_'+q_id).style.display = 'none';
    document.getElementById('file_upload').value = q_id;

    document.questionaire_form.action="../ajax/photo_upload.php";
    //document.questionaire_form.action="../ajax/form.php?question="+q_id+"&answer=&dir="+q_id;
    document.questionaire_form.target="upload_target_"+q_id;
    document.questionaire_form.submit();
    return true;
}

function startFileUpload(q_id) {

    document.getElementById('upload_process_'+q_id).style.display = 'block';
    document.getElementById('upload_form_'+q_id).style.display = 'none';
    document.getElementById('file_upload').value = q_id;

    document.questionaire_form.action="../ajax/file_upload.php";
    //document.questionaire_form.action="../ajax/form.php?question="+q_id+"&answer=&dir="+q_id;
    document.questionaire_form.target="upload_target_"+q_id;
    document.questionaire_form.submit();
    return true;
}




function removeFile(q_id, file_id) {

    var xmlhttp;
    if (window.XMLHttpRequest)
	{
	    // code for IE7+, Firefox, Chrome, Opera, Safari
	    xmlhttp=new XMLHttpRequest();
	}
    else if (window.ActiveXObject)
	{
	    // code for IE6, IE5
	    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
    else
	{
	    alert("Your browser does not support XMLHTTP!");
	}
    xmlhttp.onreadystatechange=function()
	{
	    if(xmlhttp.readyState==4)
		{
		    //document.getElementById("pic_div_"+q_id).innerHTML=responseText;
		}
	}

    var elem, vis;
    elem = document.getElementById("file_div_"+q_id+'_'+file_id);
    file_ids = document.getElementById('file_ids_'+q_id).value;
    file_ids = file_ids.replace(','+file_id+',',',');
    file_ids = file_ids.replace(file_id+',','');
    file_ids = file_ids.replace(','+file_id,'');
    file_ids = file_ids.replace(file_id,'');
    document.getElementById('file_ids_'+q_id).value = file_ids;
    //alert(document.getElementById('file_ids_'+q_id).value);
    elem.style.display = 'none'
    xmlhttp.open("GET","../ajax/delete_form_file.php?id="+file_id,true);
    xmlhttp.send(null);

}


function stopFileUpload(success, q_id, file_ids, filenames_com, msg){

    //alert(msg);
    //alert(file_ids);

    document.questionaire_form.action=document.getElementById('form_action').value;
    document.questionaire_form.target=null;
    var result = '';
    if (success == 2) {
	document.getElementById('file_ids_'+q_id).value = file_ids;
	var files = file_ids.split(",");
	var filenames = filenames_com.split(",");
	for (i=0;i<files.length;i++) {
	    result = result + '<div style="padding-bottom:3px" id="file_div_'+q_id+'_'+files[i]+'"><a href="#" style="font-size:90%" onclick="javascript:removeFile(\''+q_id+'\',\''+files[i]+'\');return false"><img border=0 src="../images/close.gif"/></a>&nbsp;&nbsp;<a href="../getFile.php?ff='+files[i]+'" />'+filenames[i]+'</a></div>';
	}       
	//result = result + '<span class="msg">The file was uploaded successfully<\/span><br/>';
      } else if (success == 1) {
	  result = '<span class="error">Illegal file type<\/span><br/>';
      } else if (success == 3) {
	  result = '<span class="error">File not copied<\/span><br/>';
      } else {
	  result = '<span class="error">There was an error during file upload<\/span><br/>';
      }
      document.getElementById('upload_process_'+q_id).style.display = 'none';
      document.getElementById('files_'+q_id).innerHTML = result;// + '<input name="file_upload_'+q_id+'" type="file" size="30" />';
      document.getElementById('upload_form_'+q_id).innerHTML = '<input name="file_upload_'+q_id+'" type="file" size="30" />';
      document.getElementById('upload_form_'+q_id).style.display = 'block';      
      return true;   
}




function removePhoto(q_id, photo_id) {

    var xmlhttp;
    if (window.XMLHttpRequest)
	{
	    // code for IE7+, Firefox, Chrome, Opera, Safari
	    xmlhttp=new XMLHttpRequest();
	}
    else if (window.ActiveXObject)
	{
	    // code for IE6, IE5
	    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
    else
	{
	    alert("Your browser does not support XMLHTTP!");
	}
    xmlhttp.onreadystatechange=function()
	{
	    if(xmlhttp.readyState==4)
		{
		    //document.getElementById("pic_div_"+q_id).innerHTML=responseText;
		}
	}

    var elem, vis;
    elem = document.getElementById("pic_div_"+q_id+'_'+photo_id);
    photo_ids = document.getElementById('photo_ids_'+q_id).value;
    photo_ids = photo_ids.replace(','+photo_id+',',',');
    photo_ids = photo_ids.replace(photo_id+',','');
    photo_ids = photo_ids.replace(','+photo_id,'');
    photo_ids = photo_ids.replace(photo_id,'');
    document.getElementById('photo_ids_'+q_id).value = photo_ids;
    //alert(document.getElementById('photo_ids_'+q_id).value);
    elem.style.display = 'none'
    xmlhttp.open("GET","../ajax/delete_quote_photo.php?id="+photo_id,true);
    xmlhttp.send(null);

}


function stopUpload(success, q_id, photo_ids, msg){

    //alert(success);
    //alert(msg);
    //alert(photo_ids);
    var is_iframe = false;
    if (typeof window.frames['sag_map'] != 'undefined') {
	is_iframe = true;
    }

    if (is_iframe) {
	window.frames['sag_map'].document.questionaire_form.action=window.frames['sag_map'].document.getElementById('form_action').value;
	window.frames['sag_map'].document.questionaire_form.target=null;
    } else {
	document.questionaire_form.action=document.getElementById('form_action').value;
	document.questionaire_form.target=null;
    }
    

    var result = '';
    if (success == 2) {

	if (is_iframe) {
	    window.frames['sag_map'].document.getElementById('photo_ids_'+q_id).value = photo_ids;
	} else {
	    document.getElementById('photo_ids_'+q_id).value = photo_ids;
	}
	var images = photo_ids.split(",");
	for (i=0;i<images.length;i++) {
	    result = result + '<div id="pic_div_'+q_id+'_'+images[i]+'"><table cellpadding=0 cellspacing=0><tr><td><img style="border:1px solid #CCCCCC" src="../image_resize.php?quote_photo='+images[i]+'&max_dim=120" /></td></tr><tr><td style="text-align:center"><a href="#" style="font-size:90%" onclick="javascript:removePhoto(\''+q_id+'\',\''+images[i]+'\');return false">[remove]</a></td></tr></table></div>';
	}       
	//result = result + '<span class="msg">The file was uploaded successfully<\/span><br/>';
      } else if (success == 1) {
	  result = '<span class="error">Image format must be a jpg, gif or png<\/span><br/>';
      } else if (success == 3) {
	  result = '<span class="error">File not copied<\/span><br/>';
      } else {
	  result = '<span class="error">There was an error during file upload<\/span><br/>';
      }


    if (is_iframe) {	    
	window.frames['sag_map'].document.getElementById('upload_process_'+q_id).style.display = 'none';
	window.frames['sag_map'].document.getElementById('photos_'+q_id).innerHTML = result;// + '<input name="photo_upload_'+q_id+'" type="file" size="30" />';
	window.frames['sag_map'].document.getElementById('upload_form_'+q_id).innerHTML = '<input name="photo_upload_'+q_id+'" type="file" size="30" />';
	window.frames['sag_map'].document.getElementById('upload_form_'+q_id).style.display = 'block';      
	
    } else {
	document.getElementById('upload_process_'+q_id).style.display = 'none';
	document.getElementById('photos_'+q_id).innerHTML = result;// + '<input name="photo_upload_'+q_id+'" type="file" size="30" />';
	document.getElementById('upload_form_'+q_id).innerHTML = '<input name="photo_upload_'+q_id+'" type="file" size="30" />';
	document.getElementById('upload_form_'+q_id).style.display = 'block';
    }
    return true;   
}


function doText(string, object) {
    $(document).ready( function() {	
	    $(object).CreateBubblePopup({		
		    position : 'top',
			align	 : 'center',		
			innerHtml: string,
			width:'300px',
			innerHtmlStyle: {
			color:'#000000', 
			    'text-align':'center'
			    },		
			themeName:     'green',
			themePath: 	'../images/jquery/jquerybubblepopup-theme',
			manageMouseEvents:false
			});
	    
	    $(object).ShowBubblePopup();
	});            	 
}

function doClear() {
    $('a, div').HideAllBubblePopups();
    $('a, div').HideBubblePopup();
    $('a, div').RemoveBubblePopup();
    //setTimeout(function() { $('a, div').RemoveBubblePopup(); }, 10);
}

function goToMessage(href, id, type, user) {

    var xmlhttp;
    if (window.XMLHttpRequest)
	{
	    // code for IE7+, Firefox, Chrome, Opera, Safari
	    xmlhttp=new XMLHttpRequest();
	}
    else if (window.ActiveXObject)
	{
	    // code for IE6, IE5
	    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
    else
	{
	    alert("Your browser does not support XMLHTTP!");
	}
    xmlhttp.onreadystatechange=function()
	{
	    if(xmlhttp.readyState==4)
		{

		}
	}
    xmlhttp.open("GET","../ajax/update_message_view.php?id="+id+"&type="+type+"&user="+user,true);
    xmlhttp.send(null);


    location.replace(href);
}


function nifty_curves(browser) {
    Nifty("ul#login_split h3", "top");
    Nifty("ul#login_split div","bottom same-height");
    Nifty("ul#eco_shop_basket_split h3", "top");
    Nifty("ul#eco_shop_basket_split div","bottom same-height");
    Nifty("ul#eco_shop_tc_split h3", "top");
    Nifty("ul#eco_shop_tc_split div","bottom same-height");
    Nifty("ul#eco_shop_gift_split h3", "top");
    Nifty("ul#eco_shop_gift_split div","bottom same-height");
    Nifty("ul#news_feed_split h3", "top");
    Nifty("ul#news_feed_split div","bottom same-height");
    Nifty("ul#blog_feed_split h3", "top");
    Nifty("ul#blog_feed_split div","bottom same-height");

    Nifty("ul#case_studies_split h3", "top");
    Nifty("ul#case_studies_split div","bottom same-height");
    Nifty("div#header_box","big");
    Nifty("div#header_box_page","big");
    Nifty("div#header_link_box_page","medium");
    Nifty("div#footer_links_box_page","big");
    Nifty("div#footer_box_page","medium");
    Nifty("div#ecoshop_box_page","medium");
    Nifty("div#info_home_box","medium");
    Nifty("div#feas_home_box","medium");
    Nifty("div#quote_home_box","medium");
    Nifty("div#map_home_box","medium");
    Nifty("div#main_home_box","big");
    Nifty("div#share_box","medium");    
    Nifty("ul#share_split h3", "top");
    Nifty("ul#share_split div","bottom same-height");

    Nifty("div#reg_content,div#reg_nav","same-height");
    if (browser != 'ie6' && browser != 'ie7') {
	Nifty("ul#comm_nav a","small transparent top");
	Nifty("ul#tech_nav a","small transparent top");
	Nifty("ul#tech_nav_eng a","small transparent top");
	Nifty("ul#tech_nav_eff a","small transparent top");
	Nifty("ul#feeback_filter_nifty p","top");
	Nifty("ul#feeback_filter_nifty div","bottom same-height");
	Nifty("ul#feeback_msg_nifty div","medium");
	Nifty("ul#embed_map_nav a","small transparent top");
	Nifty("ul#flame_box_nav a","small transparent top");
    }

    Nifty("div.eco_shop_cat_links a","transparent");
    Nifty("ul#main_nav a","medium transparent top");
    Nifty("div.tech_overview_button a","transparent");
    Nifty("div.tech_overview_button_active a","transparent");
    Nifty("div#tab_list a","medium transparent");
    Nifty("div#tab_list_info a","medium transparent");
    Nifty("div#tab_list1 a","medium transparent");
    Nifty("div#tab_list2 a","medium transparent");
    //Nifty("div#tech_page","big");

}



function ajaxPostcode()
{
    var xmlhttp;
    if (window.XMLHttpRequest)
	{
	    // code for IE7+, Firefox, Chrome, Opera, Safari
	    xmlhttp=new XMLHttpRequest();
	}
    else if (window.ActiveXObject)
	{
	    // code for IE6, IE5
	    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
    else
	{
	    alert("Your browser does not support XMLHTTP!");
	}
    xmlhttp.onreadystatechange=function()
	{
	    if(xmlhttp.readyState==4)
		{
		    document.myForm.time.value=xmlhttp.responseText;
		}
	}
    xmlhttp.open("GET","postcode.php",true);
    xmlhttp.send(null);
}



function ajaxHits(table, id)
{
    var xmlhttp;
    if (window.XMLHttpRequest)
	{
	    // code for IE7+, Firefox, Chrome, Opera, Safari
	    xmlhttp=new XMLHttpRequest();
	}
    else if (window.ActiveXObject)
	{
	    // code for IE6, IE5
	    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
    else
	{
	    alert("Your browser does not support XMLHTTP!");
	}
    xmlhttp.onreadystatechange=function()
	{
	    if(xmlhttp.readyState==4)
		{
		    document.myForm.time.value=xmlhttp.responseText;
		}
	}

    var elem, vis;
    elem = document.getElementById("faq_"+id);
    if (elem.style.display == 'none') {
	xmlhttp.open("GET","update_hit_count.php?table="+table+"&id="+id,true);
	xmlhttp.send(null);
    }
}


function popup_window(mylink, windowname, width, height) {
    if (! window.focus) {
	return true;
    }
    var href;
    if (typeof(mylink) == 'string') {
	href=mylink;
    } else {
	href=mylink.href;
    }
    window.open(href, windowname, 'width='+width+',height='+height+',scrollbars=yes');
    return false;
}



function popup(mylink, windowname) {
    if (! window.focus) {
	return true;
    }
    var href;
    if (typeof(mylink) == 'string') {
	href=mylink;
    } else {
	href=mylink.href;
    }
    window.open(href, windowname, 'width=400,height=300,scrollbars=yes');
    return false;
}

var img_eng_menu = false;
var img_eff_menu = false;

function toggleLayerImg(whichLayer, img_eng_menu_st, img_eff_menu_st) {

    if (img_eff_menu == false) {
	img_eff_menu = img_eff_menu_st;
    }
    if (img_eng_menu == false) {
	img_eng_menu = img_eng_menu_st;
    }

    var imgX = "img_"+whichLayer;
    var imageX = eval(imgX);
    var elem, vis;

    if(document.getElementById) {// this is the way the standards work
	elem = document.getElementById(whichLayer);
    } else if(document.all) // this is the way old msie versions work
	elem = document.all[whichLayer];
    else if(document.layers) // this is the way nn4 works
	elem = document.layers[whichLayer];
    vis = elem.style;
    // if the style.display value is blank we try to figure it out here
    if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
	vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
    vis.display = (vis.display==''||vis.display=='block')?'none':'block';

    //alert(imgX + ", " + imageX);

    if (imageX=='plus') {
	document.getElementById(imgX).src='../images/minus.gif';
	eval(imgX+"='minus';");
	//imageX='minus';
    } else {
	document.getElementById(imgX).src='../images/plus.gif';
	eval(imgX+"='plus';");
	//imageX='plus';
    }


    //vis.display='block';
}


function toggleLayer(whichLayer) {

    var elem, vis;
    if(document.getElementById) {// this is the way the standards work
	elem = document.getElementById(whichLayer);
    } else if(document.all) {// this is the way old msie versions work
	elem = document.all[whichLayer];
    } else if(document.layers) {// this is the way nn4 works
	elem = document.layers[whichLayer];
    }
    vis = elem.style;

    // if the style.display value is blank we try to figure it out here
    if(vis.display==''&& elem.offsetWidth!=undefined && elem.offsetHeight!=undefined)
	vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
    vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}


function showLayerHideClickDiv(whichLayer, clickDiv) {
    toggleLayer(whichLayer);
    toggleLayer(clickDiv);
}



function toggleSection(whichLayer, scroll_to) {

    var elem, vis, i = 0;
    var cond = 1, section;
    while (cond == 1) {
	cond = 0;
	section = 'questsec_'+i;
	if(document.getElementById) {// this is the way the standards work
	    elem = document.getElementById(section);
	} else if(document.all) {// this is the way old msie versions work
	    elem = document.all[section];
	} else if(document.layers) {// this is the way nn4 works
	    elem = document.layers[section];
	}
	if (elem) {
	    cond = 1;
	    vis = elem.style;
	    //alert(whichLayer+", "+section);
	    if (whichLayer == section) {
		vis.display = 'block';
		document.getElementById("questsectab_"+i).setAttribute("class", "activelink");
		if (scroll_to != null) {
		    scroll_to(scroll_to);
		}
		//alert(section);
	    } else {
		vis.display = 'none';
		document.getElementById("questsectab_"+i).setAttribute("class", "");
	    }
	}
	i = i + 1;
    }
}


function enableSubmit(whichLayer) {
    var elem;
    var elem_submit;
    if(document.getElementById) {
	elem = document.getElementById(whichLayer);
	elem_submit = document.getElementById(whichLayer + '_submit');
    }
    if (elem.checked == true) {
	elem_submit.disabled=false;
    }
    if (elem_main.checked == true) {
	elem_submit.disabled=false;
    }
}

function goToURL(theUrl) {
    document.location.href = theUrl;
}


//function goToURL_scroll(theUrl, scroll_to) {
//    document.location.href = theUrl;
//    //goToAnchor(scroll_to);
//    scroll_to(scroll_to);
//}

function scroll_div(scroll_to) {
    document.getElementById('form_answers_div').scrollTop = document.getElementById(scroll_to).offsetTop;
}


function goToAnchor(anchorname) {
    var res = location.href.split("#");
    location.replace(res[0]+'#'+anchorname);
}



function ajaxUpdateQuestionaireLists(question_id)  {
    var xmlhttp;
    var select = document.getElementById(question_id);
    var myvalue= select.options[select.selectedIndex].value;

    if (window.XMLHttpRequest)  {
	// code for IE7+, Firefox, Chrome, Opera, Safari
	xmlhttp=new XMLHttpRequest();
    } else if (window.ActiveXObject) {
	// code for IE6, IE5
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    } else {
	alert("Your browser does not support XMLHTTP!");
    }

    xmlhttp.onreadystatechange=function() {
	if(xmlhttp.readyState==4)	{
	    //document.myForm.questionaire.value=xmlhttp.responseText;
	    var res = xmlhttp.responseText.split("::::");
	    //alert(res[0]+", "+res[1]);
	    document.getElementById(question_id+"_other").innerHTML="<div id=\""+question_id+"_other\"></div>";
	    document.getElementById(res[0]).innerHTML=res[1];
	    //document.getElementById("q_id_135_Installation_details_other").innerHTML=res[1];
	    //document.getElementById(q_id+"_other").innerHTML = '<input type="text" name="'+q_id+'" value=""/>';
	}
    }


    //alert("../ajax/update_questionaire_lists.php?question_id="+question_id+"&answer="+myvalue);
    xmlhttp.open("get","../ajax/update_questionaire_lists.php?question_id="+question_id+"&answer="+myvalue,true);
    xmlhttp.send(null);
}


function ajaxInstallerCustomerCommunicationsLog(quote_id, state)  {
    var xmlhttp;

    if (window.XMLHttpRequest)  {
	// code for IE7+, Firefox, Chrome, Opera, Safari
	xmlhttp=new XMLHttpRequest();
    } else if (window.ActiveXObject) {
	// code for IE6, IE5
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    } else {
	alert("Your browser does not support XMLHTTP!");
    }

    xmlhttp.onreadystatechange=function() {
	if(xmlhttp.readyState==4)	{
	    //document.myForm.questionaire.value=xmlhttp.responseText;
	    var res = xmlhttp.responseText.split("::::");
	    //alert(res[0]+", "+res[1]);
	    document.getElementById("quote_communications_thumb"+quote_id).innerHTML=res[0];
	    document.getElementById("quote_communications_"+quote_id).innerHTML=res[1];
	}
    }

    if (state == 'open') {
	//alert("../ajax/update_questionaire_lists.php?question_id="+question_id+"&answer="+myvalue);
	xmlhttp.open("get","../ajax/get_installer_communication_quote_log.php?quote_id="+quote_id,true);
	xmlhttp.send(null);
    } else {
	document.getElementById("quote_communications_"+quote_id).innerHTML="";
    }
}

function ajax_submit_installer_customer_communication_form(quote_id) {

    var myvalue = "";
    select = document.getElementsByName("rating_"+quote_id);
    for (i=0; i<select.length; i++){
	if (select[i].checked == true) {
	    myvalue = select[i].value;
	}
    }

    var params = "quote_id="+quote_id+"&communication="+document.getElementById('communication_'+quote_id).value+"&rating="+myvalue;
    //alert(params);
    //alert(document.getElementById('communication_'+quote_id))
   if (window.XMLHttpRequest)  {
	// code for IE7+, Firefox, Chrome, Opera, Safari
	xmlhttp=new XMLHttpRequest();
    } else if (window.ActiveXObject) {
	// code for IE6, IE5
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    } else {
	alert("Your browser does not support XMLHTTP!");
    }

    xmlhttp.onreadystatechange=function() {
	if(xmlhttp.readyState==4)	{
	    var res = xmlhttp.responseText.split("::::");
	    //alert(res[0]+", "+res[1]);
	    document.getElementById("quote_communications_thumb"+quote_id).innerHTML=res[0];
	    document.getElementById("quote_communications_"+quote_id).innerHTML=res[1];
	}
    }

    xmlhttp.open("POST", "../ajax/get_installer_communication_quote_log.php?quote_id="+quote_id, true);

    //Send the proper header information along with the request
    xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlhttp.setRequestHeader("Content-length", params.length);
    xmlhttp.setRequestHeader("Connection", "close");

    xmlhttp.send(params);


}





function ajax_submit_installer_installation_feedback_reply(id, form_id) {

    var myvalue = "";
    select = document.getElementById("reply_to_feedback_"+id);
    if (select != null) {
	myvalue = select.value;
    }

    var params = "id="+id+"&reply="+myvalue;
    //alert(params);
    //return;
   if (window.XMLHttpRequest)  {
	// code for IE7+, Firefox, Chrome, Opera, Safari
	xmlhttp=new XMLHttpRequest();
    } else if (window.ActiveXObject) {
	// code for IE6, IE5
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    } else {
	alert("Your browser does not support XMLHTTP!");
    }

    xmlhttp.onreadystatechange=function() {
	if(xmlhttp.readyState==4)	{
	    alert(xmlhttp.responseText);
	    ajaxGetInstallationMap(form_id);
	}
    }

    xmlhttp.open("POST", "../ajax/update_installation_installer_feedback_reply.php", true);

    //Send the proper header information along with the request
    xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlhttp.setRequestHeader("Content-length", params.length);
    xmlhttp.setRequestHeader("Connection", "close");

    xmlhttp.send(params);


}




function ajax_submit_installer_installation_flag(id, form_id)  {

    var xmlhttp;
    var select;

    select = document.getElementsByName("installation_flag_"+id);
    for (i=0; i<select.length; i++){
	if (select[i].checked == true) {
	    myvalue = select[i].value;
	}
    }

    if (window.XMLHttpRequest)  {
	// code for IE7+, Firefox, Chrome, Opera, Safari
	xmlhttp=new XMLHttpRequest();
    } else if (window.ActiveXObject) {
	// code for IE6, IE5
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    } else {
	alert("Your browser does not support XMLHTTP!");
    }

    xmlhttp.onreadystatechange=function() {
	if(xmlhttp.readyState==4)	{
	    //alert(xmlhttp.responseText);
	    ajaxGetInstallationMap(form_id);
	}
    }

    //alert("../ajax/update_installer_manufacturers.php?inst_id="+installer_id+"&tech_id="+tech_id+"&man="+manufacturer);
    if (myvalue) {
	xmlhttp.open("get","../ajax/update_installation_installer_flag.php?id="+id+"&type="+myvalue,true);
	xmlhttp.send(null);
    }
}




function ajaxUpdateInstallersManfacturers(installer_id, tech_id)  {
    var xmlhttp;
    var select = document.getElementById('manufacturer_'+tech_id);
    var manufacturer= select.options[select.selectedIndex].value;

    if (window.XMLHttpRequest)  {
	// code for IE7+, Firefox, Chrome, Opera, Safari
	xmlhttp=new XMLHttpRequest();
    } else if (window.ActiveXObject) {
	// code for IE6, IE5
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    } else {
	alert("Your browser does not support XMLHTTP!");
    }

    xmlhttp.onreadystatechange=function() {
	if(xmlhttp.readyState==4)	{
	    //document.myForm.time.value=xmlhttp.responseText;
	    document.getElementById('installer_man_list_'+tech_id).innerHTML=xmlhttp.responseText;
	}
    }

    //alert("../ajax/update_installer_manufacturers.php?inst_id="+installer_id+"&tech_id="+tech_id+"&man="+manufacturer);
    xmlhttp.open("get","../ajax/update_installer_manufacturers.php?inst_id="+installer_id+"&tech_id="+tech_id+"&man="+manufacturer,true);
    xmlhttp.send(null);
}


function ajaxUpdateListItem(item_id, action)  {

    if (action == 'del') {
	var r=confirm("Confirm deletion. This will delete any answers submitted to the database.");
	if (r==false) {
	    return;
	}
    }
    if (action == 'update') {
	var r=confirm("Note. This will update any answers submitted to the database.");
	if (r==false) {
	    return;
	}
    }
    
    var xmlhttp;
    var select = document.getElementById("item_"+item_id);
    var item;
    if (select != null) {
	item = select.value;
    }

    if (window.XMLHttpRequest)  {
	// code for IE7+, Firefox, Chrome, Opera, Safari
	xmlhttp=new XMLHttpRequest();
    } else if (window.ActiveXObject) {
	// code for IE6, IE5
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    } else {
	alert("Your browser does not support XMLHTTP!");
    }

    var params = "item_id="+item_id+"&item="+item+"&action="+action;

    xmlhttp.onreadystatechange=function() {
	if(xmlhttp.readyState==4)	{
	    //document.myForm.time.value=xmlhttp.responseText;
	    document.getElementById('item_list').innerHTML=xmlhttp.responseText;
	}
    }

    xmlhttp.open("POST", "../ajax/update_admin_list_items.php", true);

    //Send the proper header information along with the request
    xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlhttp.setRequestHeader("Content-length", params.length);
    xmlhttp.setRequestHeader("Connection", "close");

    xmlhttp.send(params);

}


function ajaxAddListItem(identifier)  {
    var xmlhttp;
    var select = document.getElementById("add_item");
    var item;
    if (select != null) {
	item = select.value;
    }

    if (window.XMLHttpRequest)  {
	// code for IE7+, Firefox, Chrome, Opera, Safari
	xmlhttp=new XMLHttpRequest();
    } else if (window.ActiveXObject) {
	// code for IE6, IE5
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    } else {
	alert("Your browser does not support XMLHTTP!");
    }

    var params = "item="+item+"&identifier="+identifier+"&action=add";

    xmlhttp.onreadystatechange=function() {
	if(xmlhttp.readyState==4)	{
	    //document.myForm.time.value=xmlhttp.responseText;
	    document.getElementById('item_list').innerHTML=xmlhttp.responseText;
	}
    }

    xmlhttp.open("POST", "../ajax/update_admin_list_items.php", true);

    //Send the proper header information along with the request
    xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlhttp.setRequestHeader("Content-length", params.length);
    xmlhttp.setRequestHeader("Connection", "close");

    xmlhttp.send(params);

}


function ajaxUpdateProductRating(product,tech)  {
//    var xmlhttp;
//    var select = document.getElementById(product);
//    var product_val = select.options[select.selectedIndex].value;
//
//    if (window.XMLHttpRequest)  {
//	// code for IE7+, Firefox, Chrome, Opera, Safari
//	xmlhttp=new XMLHttpRequest();
//    } else if (window.ActiveXObject) {
//	// code for IE6, IE5
//	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
//    } else {
//	alert("Your browser does not support XMLHTTP!");
//    }
//
//    xmlhttp.onreadystatechange=function() {
//	if(xmlhttp.readyState==4)	{
//	    //document.myForm.time.value=xmlhttp.responseText;
//	    document.getElementById(product+"_rating").innerHTML=xmlhttp.responseText;
	    ajaxFeedbackFilter(tech);
//	}
//    }
//
//    //alert("../ajax/update_product_rating.php?product="+product+"&name="+product_val+"&tech="+tech);
//    xmlhttp.open("get", "../ajax/update_product_rating.php?product="+product+"&name="+product_val+"&tech="+tech,true);
//    xmlhttp.send(null);
}

function ajaxUpdateInstallerRating(inst_form_name,tech)  {
//    var xmlhttp;
//    var select = document.getElementById(inst_form_name);
//    var inst_id = select.options[select.selectedIndex].value;
//
//    if (window.XMLHttpRequest)  {
//	// code for IE7+, Firefox, Chrome, Opera, Safari
//	xmlhttp=new XMLHttpRequest();
//    } else if (window.ActiveXObject) {
//	// code for IE6, IE5
//	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
//    } else {
//	alert("Your browser does not support XMLHTTP!");
//    }
//
//    xmlhttp.onreadystatechange=function() {
//	if(xmlhttp.readyState==4)	{
//	    //document.myForm.time.value=xmlhttp.responseText;
//	    document.getElementById("installer_list_rating").innerHTML=xmlhttp.responseText;
	    ajaxFeedbackFilter(tech);
//	}
//    }
//
//    //alert("../ajax/update_product_rating.php?product="+product+"&name="+product_val+"&tech="+tech);
//    xmlhttp.open("get", "../ajax/update_installer_rating.php?inst_id="+inst_id+"&tech="+tech,true);
//    xmlhttp.send(null);
}



//====================================================================================================




//====================================================================================================


function ajaxUpdateFeedbackFilterLists(tech) {
   var xmlhttp;
    var select = document.getElementById('manufacturer_list');
    var manufacturer = select.options[select.selectedIndex].value;
    select = document.getElementById('product_name_list');
    var name = select.options[select.selectedIndex].value;
    select = document.getElementById('installer_list');
    var inst_id = select.options[select.selectedIndex].value;

    if (window.XMLHttpRequest)  {
	// code for IE7+, Firefox, Chrome, Opera, Safari
	xmlhttp=new XMLHttpRequest();
    } else if (window.ActiveXObject) {
	// code for IE6, IE5
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    } else {
	alert("Your browser does not support XMLHTTP!");
    }

    xmlhttp.onreadystatechange=function() {
	if(xmlhttp.readyState==4)	{
	    //document.getElementById("feedback_output").innerHTML=xmlhttp.responseText;
	    var res = xmlhttp.responseText.split("::::");
	    document.getElementById('installer_list_div').innerHTML=res[0];
	    document.getElementById('installer_list_rating').innerHTML=res[1];
	    document.getElementById('manufacturer_list_div').innerHTML=res[2];
	    document.getElementById('manufacturer_list_rating').innerHTML=res[3];
	    document.getElementById('product_name_list_div').innerHTML=res[4];
	    document.getElementById('product_name_list_rating').innerHTML=res[5];
	}
    }

    xmlhttp.open("get", "../ajax/ajax_feedback_filter_lists.php?inst_id="+inst_id+"&tech="+tech+"&manufacturer="+manufacturer+"&name="+name,true);
    xmlhttp.send(null);
}



function ajaxFeedbackFilter(tech) {
    var xmlhttp;
    var select = document.getElementById('manufacturer_list');
    var manufacturer = select.options[select.selectedIndex].value;
    select = document.getElementById('product_name_list');
    var name = select.options[select.selectedIndex].value;
    select = document.getElementById('installer_list');
    var inst_id = select.options[select.selectedIndex].value;

    if (window.XMLHttpRequest)  {
	// code for IE7+, Firefox, Chrome, Opera, Safari
	xmlhttp=new XMLHttpRequest();
    } else if (window.ActiveXObject) {
	// code for IE6, IE5
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    } else {
	alert("Your browser does not support XMLHTTP!");
    }

    xmlhttp.onreadystatechange=function() {
	if(xmlhttp.readyState==4)	{
	    //document.myForm.time.value=xmlhttp.responseText;
	    document.getElementById("feedback_output").innerHTML=xmlhttp.responseText;
	    ajaxUpdateFeedbackFilterLists(tech);
	}
    }
    //alert("../ajax/feedback_output.php?inst_id="+inst_id+"&tech="+tech+"&manufacturer="+manufacturer+"&name="+name);
    xmlhttp.open("get", "../ajax/ajax_feedback_output.php?inst_id="+inst_id+"&tech="+tech+"&manufacturer="+manufacturer+"&name="+name,true);
    xmlhttp.send(null);


}

function ajaxGetFeedback(id, page)  {
    var xmlhttp;

    if (window.XMLHttpRequest)  {
	// code for IE7+, Firefox, Chrome, Opera, Safari
	xmlhttp=new XMLHttpRequest();
    } else if (window.ActiveXObject) {
	// code for IE6, IE5
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    } else {
	alert("Your browser does not support XMLHTTP!");
    }

    xmlhttp.onreadystatechange=function() {
	if(xmlhttp.readyState==4)	{
	    //document.myForm.time.value=xmlhttp.responseText;
	    if (page == 'info') {
		document.getElementById('feedback_view_details').innerHTML=xmlhttp.responseText;
		document.getElementById("feedback_output").style.display="none";
		//scroll_to('feedback_view_details');
	    } else {
		document.getElementById('installer_output').innerHTML="";
		document.getElementById('installation_output').innerHTML="";
		document.getElementById("feedback_output").innerHTML=xmlhttp.responseText;
		document.getElementById('clear_output').style.display="block";
		if (page == 'gis_map') {
		    scroll_to('gis_output_view');
		}
	    }
	}
    }

    //alert("../ajax/feedback_output.php?id="+id+"&page="+page);
    xmlhttp.open("get", "../ajax/ajax_feedback_display.php?id="+id+"&page="+page,true);
    xmlhttp.send(null);
}

function clear_gis_map_output(id) {
    if (id > 0) {
	document.getElementById('installation_output_'+id).innerHTML="";
    } else {
	document.getElementById('installer_output').innerHTML="";
	document.getElementById('installation_output').innerHTML="";
	document.getElementById('technology_product_output').innerHTML="";
	document.getElementById('clear_output').style.display="none";
	if (document.getElementById('gis_map_tool')) {
	    scroll_to('gis_map_app');
	} else {
	    scroll_to('map_tool_gis');
	}	
    }
}

function clear_prequote_inst_list_output(id) {
    document.getElementById('installer_output_'+id).innerHTML="";
}


function ajaxGetInstallation(id)  {
    var xmlhttp;

    if (window.XMLHttpRequest)  {
	// code for IE7+, Firefox, Chrome, Opera, Safari
	xmlhttp=new XMLHttpRequest();
    } else if (window.ActiveXObject) {
	// code for IE6, IE5
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    } else {
	alert("Your browser does not support XMLHTTP!");
    }

    xmlhttp.onreadystatechange=function() {
	if(xmlhttp.readyState==4)	{
	    document.getElementById('clear_output').style.display="block";
	    document.getElementById('installer_output').innerHTML="";
	    document.getElementById('technology_product_output').innerHTML="";
	    document.getElementById("installation_output").innerHTML=xmlhttp.responseText;
	    scroll_to('gis_output_view');
	}
    }

    //alert("../ajax/ajax_installer_installations.php?id="+id);
    xmlhttp.open("get", "../ajax/ajax_installations.php?id="+id,true);
    xmlhttp.send(null);
}


function ajaxGetInstallationMap(id)  {
    var xmlhttp;

    if (window.XMLHttpRequest)  {
	// code for IE7+, Firefox, Chrome, Opera, Safari
	xmlhttp=new XMLHttpRequest();
    } else if (window.ActiveXObject) {
	// code for IE6, IE5
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    } else {
	alert("Your browser does not support XMLHTTP!");
    }

    xmlhttp.onreadystatechange=function() {
	if(xmlhttp.readyState==4)	{

	    if (document.getElementById("installation_output_"+id)) {
		document.getElementById("installation_output_"+id).innerHTML=xmlhttp.responseText;
	    } else {
		document.getElementById('clear_output').style.display="block";
		document.getElementById('installer_output').innerHTML="";
		document.getElementById('technology_product_output').innerHTML="";
		document.getElementById("installation_output").innerHTML=xmlhttp.responseText;
		scroll_to('gis_output_view');
	    }
	}
    }

    var query = "../ajax/ajax_installations_map.php?id="+id;
    if (document.getElementById("installation_output_"+id)) {
	query = query + "&page=myi";
    }
    xmlhttp.open("get", query,true);
    xmlhttp.send(null);
}


function ajaxGetInstallationID(id)  {
    var xmlhttp;

    if (window.XMLHttpRequest)  {
	// code for IE7+, Firefox, Chrome, Opera, Safari
	xmlhttp=new XMLHttpRequest();
    } else if (window.ActiveXObject) {
	// code for IE6, IE5
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    } else {
	alert("Your browser does not support XMLHTTP!");
    }

    xmlhttp.onreadystatechange=function() {
	if(xmlhttp.readyState==4)	{
	    document.getElementById("installation_output_"+id).innerHTML=xmlhttp.responseText;
	}
    }

    //alert("../ajax/ajax_installer_installations.php?id="+id);
    xmlhttp.open("get", "../ajax/ajax_installations.php?id="+id+"&page=myi",true);
    xmlhttp.send(null);
}



function ajaxTechnologyProductProfile(id)  {
    var xmlhttp;

    if (window.XMLHttpRequest)  {
	// code for IE7+, Firefox, Chrome, Opera, Safari
	xmlhttp=new XMLHttpRequest();
    } else if (window.ActiveXObject) {
	// code for IE6, IE5
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    } else {
	alert("Your browser does not support XMLHTTP!");
    }

    xmlhttp.onreadystatechange=function() {
	if(xmlhttp.readyState==4)	{
	    document.getElementById('clear_output').style.display="block";
	    document.getElementById('installer_output').innerHTML="";
	    document.getElementById('technology_product_output').innerHTML="";
	    document.getElementById("installation_output").innerHTML=xmlhttp.responseText;
	    scroll_to('gis_output_view');
	}
    }

    //alert("../ajax/ajax_installer_installations.php?id="+id);
    xmlhttp.open("get", "../ajax/technology_product_profile.php?id="+id,true);
    xmlhttp.send(null);
}



function ajaxGetMapSummaryTechInfo(id)  {
    var xmlhttp;

    if (window.XMLHttpRequest)  {
	// code for IE7+, Firefox, Chrome, Opera, Safari
	xmlhttp=new XMLHttpRequest();
    } else if (window.ActiveXObject) {
	// code for IE6, IE5
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    } else {
	alert("Your browser does not support XMLHTTP!");
    }

    xmlhttp.onreadystatechange=function() {
	if(xmlhttp.readyState==4)	{
	    //document.getElementById('clear_output').style.display="block";
	    document.getElementById("tech_summary_"+id).innerHTML=xmlhttp.responseText;
	}
    }
    xmlhttp.open("get", "../ajax/ajax_map_tech_summary.php?tech="+id,true);
    xmlhttp.send(null);
}

function clear_tech_summary_map_output(id) {
    if (id > 0) {
	document.getElementById('tech_summary_'+id).innerHTML="";
    }
}


function ajaxGetMapSummaryInstallerInfo(id)  {
    var xmlhttp;

    if (window.XMLHttpRequest)  {
	// code for IE7+, Firefox, Chrome, Opera, Safari
	xmlhttp=new XMLHttpRequest();
    } else if (window.ActiveXObject) {
	// code for IE6, IE5
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    } else {
	alert("Your browser does not support XMLHTTP!");
    }

    xmlhttp.onreadystatechange=function() {
	if(xmlhttp.readyState==4)	{
	    //document.getElementById('clear_output').style.display="block";
	    document.getElementById("installer_summary_"+id).innerHTML=xmlhttp.responseText;
	}
    }
    xmlhttp.open("get", "../ajax/ajax_map_installer_summary.php?inst="+id,true);
    xmlhttp.send(null);
}

function clear_installer_summary_map_output(id) {
    if (id > 0) {
	document.getElementById('installer_summary_'+id).innerHTML="";
    }
}


function map_embed_tab_links(page) {

    var pages=new Array(); // regular array (add an optional integer
    pages[0]="map_page";
    pages[1]="summary_page";
    pages[2]="free_quotes_page";
    pages[3]="embed_page";
    pages[4]="add_installation_page";

    for (i=0; i<pages.length; i++){

	//alert(pages[i]+", "+document.getElementById(pages[i]+"_tab") + " " + (document.getElementById(pages[i]+"_tab") != null));
	if (page == pages[i]) {
	    document.getElementById(page).style.display='block';
	    if (document.getElementById(pages[i]+"_tab") != null) {
		    document.getElementById(page+'_tab').className='embed_map_activelink';
	    }
	} else {
	    document.getElementById(pages[i]).style.display='none';
	    if (document.getElementById(pages[i]+"_tab") != null) {
		document.getElementById(pages[i]+'_tab').className='';
	    }
	}
    }
}




function ajaxVisibleInstallation(id, user_type)  {
    var xmlhttp;
    var checked;
    if (window.XMLHttpRequest)  {
	// code for IE7+, Firefox, Chrome, Opera, Safari
	xmlhttp=new XMLHttpRequest();
    } else if (window.ActiveXObject) {
	// code for IE6, IE5
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    } else {
	alert("Your browser does not support XMLHTTP!");
    }

    xmlhttp.onreadystatechange=function() {
	if(xmlhttp.readyState==4)	{
	    document.getElementById("inst_vis_output").innerHTML = xmlhttp.responseText;
	}
    }

    if (document.getElementById("installation_visible_"+id).checked == true) {
	checked = 't';
    } else {
	checked = 'f';
    }

    //alert("../ajax/ajax_installation_visibility.php?id="+id+"&user_type="+user_type+"&checked="+checked);
    xmlhttp.open("get", "../ajax/ajax_installation_visibility.php?id="+id+"&user_type="+user_type+"&checked="+checked,true);
    xmlhttp.send(null);
}



function feedback_back_to_list() {
    document.getElementById('feedback_view_details').innerHTML='';
    document.getElementById('feedback_output').style.display = 'block';
}


function ajaxDeleteInstallersManfacturers(installer_id, tech_id, man)  {
    var xmlhttp;
    if (window.XMLHttpRequest)  {
	// code for IE7+, Firefox, Chrome, Opera, Safari
	xmlhttp=new XMLHttpRequest();
    } else if (window.ActiveXObject) {
	// code for IE6, IE5
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    } else {
	alert("Your browser does not support XMLHTTP!");
    }

    xmlhttp.onreadystatechange=function() {
	if(xmlhttp.readyState==4)	{
	    //document.myForm.time.value=xmlhttp.responseText;
	    document.getElementById('installer_man_list_'+tech_id).innerHTML=xmlhttp.responseText;
	}
    }
    //alert("update_installer_manfacturers.php?inst_id="+installer_id+"&tech_id="+tech_id+"&man="+man);
    xmlhttp.open("get","../ajax/update_installer_manufacturers.php?inst_id="+installer_id+"&tech_id="+tech_id+"&man="+man+"&del=1",true);
    xmlhttp.send(null);
}



function ajaxUpdateInstallersOR(installer_id)  {

    if (window.XMLHttpRequest)  {
	// code for IE7+, Firefox, Chrome, Opera, Safari
	xmlhttp=new XMLHttpRequest();
    } else if (window.ActiveXObject) {
	// code for IE6, IE5
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    } else {
	alert("Your browser does not support XMLHTTP!");
    }

    xmlhttp.onreadystatechange=function() {
	if(xmlhttp.readyState==4)	{
	    document.getElementById('installer_or_list').innerHTML=xmlhttp.responseText;
	}
    }
    //alert("../ajax/update_installer_or.php?inst_id="+installer_id);
    xmlhttp.open("get","../ajax/update_installer_or.php?inst_id="+installer_id+"&or_id="+document.getElementById('operational_regions').value,true);
    xmlhttp.send(null);
}


function ajaxDeleteInstallersOR(installer_id, or_id)  {
    var xmlhttp;
    if (window.XMLHttpRequest)  {
	// code for IE7+, Firefox, Chrome, Opera, Safari
	xmlhttp=new XMLHttpRequest();
    } else if (window.ActiveXObject) {
	// code for IE6, IE5
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    } else {
	alert("Your browser does not support XMLHTTP!");
    }

    xmlhttp.onreadystatechange=function() {
	if(xmlhttp.readyState==4)	{
	    //document.myForm.time.value=xmlhttp.responseText;
	    document.getElementById('installer_or_list').innerHTML=xmlhttp.responseText;
	}
    }
    xmlhttp.open("get","../ajax/update_installer_or.php?inst_id="+installer_id+"&or_id="+or_id+"&del=1",true);
    xmlhttp.send(null);
}




function ajaxUpdateInstallers2quotes(job_id)  {

    if (window.XMLHttpRequest)  {
	// code for IE7+, Firefox, Chrome, Opera, Safari
	xmlhttp=new XMLHttpRequest();
    } else if (window.ActiveXObject) {
	// code for IE6, IE5
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    } else {
	alert("Your browser does not support XMLHTTP!");
    }

    xmlhttp.onreadystatechange=function() {
	if(xmlhttp.readyState==4)	{
	    document.getElementById('installers2quotes_list_'+job_id).innerHTML=xmlhttp.responseText;
	}
    }
    //alert(document.getElementById('installers2quotes').value);
    //alert("../ajax/update_installer2quotes.php?job_id="+job_id+"&inst_id="+document.getElementById('installers2quotes_'+job_id).value);
    xmlhttp.open("get","../ajax/update_installer2quotes.php?job_id="+job_id+"&inst_id="+document.getElementById('installers2quotes_'+job_id).value,true);
    xmlhttp.send(null);
}


function ajaxDeleteInstallers2quotes(job_id, installer_id)  {
    var xmlhttp;
    if (window.XMLHttpRequest)  {
	// code for IE7+, Firefox, Chrome, Opera, Safari
	xmlhttp=new XMLHttpRequest();
    } else if (window.ActiveXObject) {
	// code for IE6, IE5
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    } else {
	alert("Your browser does not support XMLHTTP!");
    }

    xmlhttp.onreadystatechange=function() {
	if(xmlhttp.readyState==4)	{
	    //document.myForm.time.value=xmlhttp.responseText;
	    document.getElementById('installers2quotes_list_'+job_id).innerHTML=xmlhttp.responseText;
	}
    }
    xmlhttp.open("get","../ajax/update_installer2quotes.php?inst_id="+installer_id+"&job_id="+job_id+"&del=1",true);
    xmlhttp.send(null);
}






function ajaxGetInstallers(tech)  {
    var xmlhttp;
    if (window.XMLHttpRequest)  {
	// code for IE7+, Firefox, Chrome, Opera, Safari
	xmlhttp=new XMLHttpRequest();
    } else if (window.ActiveXObject) {
	// code for IE6, IE5
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    } else {
	alert("Your browser does not support XMLHTTP!");
    }

    xmlhttp.onreadystatechange=function() {
	if(xmlhttp.readyState==4)	{
	    //document.myForm.time.value=xmlhttp.responseText;
	    document.getElementById('display_list').innerHTML=xmlhttp.responseText;
	    document.getElementById('get_list').style.display = "none";
	    document.getElementById('display_list').style.display = "block";
	}
    }
    xmlhttp.open("get","get_installer_list.php?tech="+tech+"&postcode="+document.getElementById('postcode').value,true);
    xmlhttp.send(null);
}


function ajaxCheckEmail()  {
    var xmlhttp;
    if (window.XMLHttpRequest)  {
	// code for IE7+, Firefox, Chrome, Opera, Safari
	xmlhttp=new XMLHttpRequest();
    } else if (window.ActiveXObject) {
	// code for IE6, IE5
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    } else {
	alert("Your browser does not support XMLHTTP!");
    }

    xmlhttp.onreadystatechange=function() {
	if(xmlhttp.readyState==4)	{
	    //document.myForm.time.value=xmlhttp.responseText;
	    if (xmlhttp.responseText == 'installer') {
		document.getElementById('get_a_quote_installer_message').innerHTML='<div style="text-align:justify;" class="error_message"><b>Please note</b> as an installer you cannot submit a quote. But you can look through the questions and if there is anything missing that you would need to make a quote then please contact us at <a href="mailto:info@saveandgenerate.com">info@saveandgenerate.com</a>.</div>';
		document.getElementById('submit_questionaire').disabled=true;
	    } else {
		//alert(xmlhttp.responseText);
		document.getElementById('gc_passwd_req').innerHTML=xmlhttp.responseText;
		document.getElementById('gc_passwd_req').style.display = "block";
		document.getElementById('err_msg').style.display = "none";
	    }
	}
    }
    ajaxCheckEmailTitle(document.getElementById('email').value);
    xmlhttp.open("get","../check_login.php?email="+document.getElementById('email').value,true);
    xmlhttp.send(null);
}

function ajaxCheckEmailTitle(email)  {
    var xmlhttp;
    if (window.XMLHttpRequest)  {
	// code for IE7+, Firefox, Chrome, Opera, Safari
	xmlhttp=new XMLHttpRequest();
    } else if (window.ActiveXObject) {
	// code for IE6, IE5
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    } else {
	alert("Your browser does not support XMLHTTP!");
    }

    xmlhttp.onreadystatechange=function() {
	if(xmlhttp.readyState==4)	{
	    //document.myForm.time.value=xmlhttp.responseText;
	    document.getElementById('gc_passwd_req_title').innerHTML=xmlhttp.responseText;
	    document.getElementById('gc_passwd_req_title').style.display = "block";
	}
    }
    xmlhttp.open("get","../check_login.php?tit=1&email="+email,true);
    xmlhttp.send(null);
}




function ajaxInstallerProfile(id, page)  {
    var xmlhttp;
    var window_width = get_window_width();

    if (window.XMLHttpRequest)  {
	// code for IE7+, Firefox, Chrome, Opera, Safari
	xmlhttp=new XMLHttpRequest();
    } else if (window.ActiveXObject) {
	// code for IE6, IE5
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    } else {
	alert("Your browser does not support XMLHTTP!");
    }

    xmlhttp.onreadystatechange=function() {
	if(xmlhttp.readyState==4)	{
	    //document.myForm.time.value=xmlhttp.responseText;
	    //document.getElementById('quote_inst_prof').innerHTML=xmlhttp.responseText;
	    //document.getElementById('quote_inst_list').style.display = "none";

	    if (page == 'quote_process') {
		document.getElementById('installer_output_'+id).innerHTML="<div class=\"curved_borders\" style=\"border:1px solid #AFDF61;\">"+xmlhttp.responseText+"</div>";
	    } else {
		document.getElementById('installation_output').innerHTML="";
		document.getElementById('installer_output').innerHTML=xmlhttp.responseText;
		document.getElementById('clear_output').style.display="block";
		
		if (page == 'pre-quote') {
		    document.getElementById('installer_list').style.display = "none";
		}
		
		if (page == 'gis') {
		    scroll_to('gis_output_view');
		}
	    }

	}
    }

    xmlhttp.open("get","../ajax/installer_profile.php?id="+id+"&page="+page+"&width="+window_width,true);
    xmlhttp.send(null);
}



function ajaxInstallerProfileQuotePage(id, page, tech_id)  {
    var xmlhttp;
    if (window.XMLHttpRequest)  {
	// code for IE7+, Firefox, Chrome, Opera, Safari
	xmlhttp=new XMLHttpRequest();
    } else if (window.ActiveXObject) {
	// code for IE6, IE5
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    } else {
	alert("Your browser does not support XMLHTTP!");
    }

    xmlhttp.onreadystatechange=function() {
	if(xmlhttp.readyState==4)	{
	    document.getElementById('installer_output_'+id).innerHTML=xmlhttp.responseText;
	}
    }
    xmlhttp.open("get","../ajax/installer_profile.php?id="+id+"&page="+page+"&tech="+tech_id,true);
    xmlhttp.send(null);
}



function tech_selected(tech_type, tab_id) {
    if (0) {
	var elem, vis;
	var whichLayer = 'tech_border';
	if(document.getElementById) {// this is the way the standards work
	    elem = document.getElementById(whichLayer);
	} else if(document.all) // this is the way old msie versions work
	    elem = document.all[whichLayer];
	else if(document.layers) // this is the way nn4 works
	    elem = document.layers[whichLayer];
	vis = elem.style;
	vis.border = "solid red 2px";
    }
    //var elem_tab, vis_tab;
    ////whichLayer = tab_id;
    //whichLayer = 'tech_ti';
    //if(document.getElementById) {// this is the way the standards work
    //	elem_tab = document.getElementById(whichLayer);
    //} else if(document.all) // this is the way old msie versions work
    //	elem_tab = document.all[whichLayer];
    //else if(document.layers) // this is the way nn4 works
    //	elem_tab = document.layers[whichLayer];
    //vis_tab = elem_tab.style;
    //vis_tab.background = "red";

}


function inst_list_profile(inst_id) {
    document.getElementById('submit_questionaire').value = 'Request quote';
    document.getElementById('inst_id').value = inst_id;
    document.getElementById('vd').value=-1;
    document.questionaire_form_submit.submit();
}

function view_feedback_inst_list_profile(inst_id, vd) {
    document.getElementById('submit_questionaire').value = 'Request quote';
    document.getElementById('inst_id').value = inst_id;
    document.getElementById('vd').value = vd;
    document.questionaire_form_submit.submit();
}



function ajaxLinkEcoShopImages(item_id)  {
    if (item_id == -1) {
	id_elem = 'list_eco_images';
	image_file = 'image_file';
	ecoimage = 'ecoimage_';
	eco_image_div = 'eco_image_div_';
    } else {
	id_elem = 'list_eco_images_'+item_id;
	image_file = 'image_file_'+item_id;
	ecoimage = 'ecoimage_'+item_id+'_';
	eco_image_div = 'eco_image_div_'+item_id+'_';
    }

    var select = document.getElementById(image_file);
    var image_id = select.options[select.selectedIndex].value;
    var res = image_id.split("::::");
    filename = res[1];
    image_id = res[0];


    if (image_id != 'Please Select') { 
	if (document.getElementById(eco_image_div+image_id)) {
	    document.getElementById(id_elem).innerHTML = '<img src="../image_resize.php?max_dim=100&amp;data_file=eco_shop/images/'+image_id+'/'+filename+'"/><input type="hidden" name="'+ecoimage+image_id+'" value="'+image_id+'"/><br/><input type="button" name="remove_eco_shop_images" value="Remove" onclick="ajaxRemoveLinkEcoShopImages(\''+item_id+'\', \''+image_id+'\')"/>';
	} else {
	    html = document.getElementById(id_elem).innerHTML;
	    document.getElementById(id_elem).innerHTML = html+'<div id="'+eco_image_div+image_id+'"><img src="../image_resize.php?max_dim=100&amp;data_file=eco_shop/images/'+image_id+'/'+filename+'"/><input type="hidden" name="'+ecoimage+image_id+'" value="'+image_id+'"/><br/><input type="button" name="remove_eco_shop_images" value="Remove" onclick="ajaxRemoveLinkEcoShopImages(\''+item_id+'\', \''+image_id+'\')"/></div>\n';
	}
    }
}


function ajaxRemoveLinkEcoShopImages(item_id, image_id)  {
    if (item_id != -1) {
	document.getElementById('eco_image_div_'+item_id+'_'+image_id).innerHTML = "";
    } else {
	document.getElementById('eco_image_div_'+image_id).innerHTML = "";
    }
}



function otherInputBox(q_id, question, java_selection, form_name) {
    document.getElementById(q_id+"_other").innerHTML = '<input type="text" onkeypress="return entsub(event, this.form, \''+question+'\', \''+java_selection+'\', \''+form_name+'\')" name="'+q_id+'_otheranswer" id="'+q_id+'_otheranswer" value=""/>';
    return true;
}

function notlistedInputBox(q_id, question, java_selection, form_name) {
    var select = document.getElementById(q_id);
    var myvalue = select.options[select.selectedIndex].value;
    if (myvalue == 'Not listed') {
	document.getElementById(q_id+"_notlisted_div").innerHTML = '<div style="padding-top:10px">Please specify: <input style="width:60%" type="text" onkeypress="return entsub(event, this.form, \''+question+'\', \''+java_selection+'\', \''+form_name+'\')" name="'+q_id+'_notlisted" id="'+q_id+'_notlisted" value=""/></div>';
    } else {
	document.getElementById(q_id+"_notlisted_div").innerHTML = '';
	update_form_page(question, 'next', java_selection, form_name);
    }
    return true;
}


function update_form_page(id, direction, selection, form_name)  {
    var xmlhttp;
    var select;
    var myvalue = 'undefined';

    if (selection == 'radiobox') {
	select = document.getElementById("question_"+id+"_otheranswer");
	if (select != null) {
	    myvalue = select.value;
	} else {	    
	    select = document.getElementsByName("question_"+id);
	    //alert(select[0].value);
	    for (i=0; i<select.length; i++){
		if (select[i].checked == true) {
		    myvalue = select[i].value;
		}
	    }
	}
    } else if (selection == 'select') {
	select = document.getElementById("question_"+id);
	myvalue = select.options[select.selectedIndex].value;
	if (myvalue == 'Not listed') {
	    select = document.getElementById("question_"+id+"_notlisted");
	    if (select != null) {
		myvalue = select.value;
	    }
	}
    } else if (selection == 'photo') {
	select = document.getElementById("photo_ids_"+id);
	if (select != null) {
	    myvalue = select.value;
	}
	//myvalue= select.options[select.selectedIndex].value;
    } else if (selection == 'file') {
	select = document.getElementById("file_ids_"+id);
	if (select != null) {
	    myvalue = select.value;
	}
	//myvalue= select.options[select.selectedIndex].value;
    } else {
	select = document.getElementById("question_"+id);
	if (select != null) {
	    myvalue = select.value;
	}
	//myvalue= select.options[select.selectedIndex].value;
    }

    select = document.getElementById("login_input");
    var passwd = "";
    if (select != null) {
	passwd = select.value;
    }
    
    if (window.XMLHttpRequest)  {
	// code for IE7+, Firefox, Chrome, Opera, Safari
	xmlhttp=new XMLHttpRequest();
    } else if (window.ActiveXObject) {
	// code for IE6, IE5
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    } else {
	alert("Your browser does not support XMLHTTP!");
   } 


    xmlhttp.onreadystatechange=function() {
	if(xmlhttp.readyState==4) {
	    document.getElementById('questionaire').innerHTML=xmlhttp.responseText;
	    popup_init();
	    //document.getElementById('questionaire').innerHTML="<div style=\"display:none;height:500px\" id=\"box\">"+xmlhttp.responseText+"</div>";
	}
    }

    myvalue = myvalue.replace('&','__ampersand__');
    //alert("../ajax/form.php?question="+id+"&answer="+myvalue+"&dir="+direction+"&pl="+passwd+"&form_name="+form_name);
    xmlhttp.open("get","../ajax/form.php?question="+id+"&answer="+myvalue+"&dir="+direction+"&pl="+passwd+"&form_name="+form_name,true);
    xmlhttp.send(null);
}



function entsub(event, ourform, question, java_selection, form_name) {

    if (event && event.which == 13) {
	update_form_page(question, 'next', java_selection, form_name);
	return false;
    } else if (window.event && window.event.keycode == 13) {
	update_form_page(question, 'next', java_selection, form_name);
	return false;
    } else {
	return true;
    }
}



function notification_viewed(id)  {

    var xmlhttp;

    if (window.XMLHttpRequest)  {
	// code for IE7+, Firefox, Chrome, Opera, Safari
	xmlhttp=new XMLHttpRequest();
    } else if (window.ActiveXObject) {
	// code for IE6, IE5
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    } else {
	alert("Your browser does not support XMLHTTP!");
    }
    xmlhttp.open("get","../ajax/notification_viewed.php?id="+id,true);
    xmlhttp.send(null);
    return true;
}


function list_users_inst_tech(type, id) {
    var select;
    if (type == 'tech') {
	select = document.getElementById("tech_"+id);
	if (select.checked == false) {
	    document.getElementById("mcs_"+id).checked=false;
	}
    } else if (type == 'mcs') {
	select = document.getElementById("mcs_"+id);
	if (select.checked == true) {
	    document.getElementById("tech_"+id).checked=true;
	}
    }
}


function checkNextTenInstallerQuote() {    
    fmobj = document.getElementById('installers_to_link');
    j = 0;
    n = 10;
    for (var i=0;i<fmobj.elements.length;i++) {
	var e = fmobj.elements[i];
	if (e.type=='checkbox' && e.checked == false) {
	    e.checked = true;
	    j++;
	}
	if (j >= n) {
	    return;
	}
    }
}


function checkAllInstallerQuote() {    
    fmobj = document.getElementById('installers_to_link');
    for (var i=0;i<fmobj.elements.length;i++) {
	var e = fmobj.elements[i];
	if (e.type=='checkbox') {
	    e.checked = true;
	}
    }
}

function uncheckAllInstallerQuote() {    
    fmobj = document.getElementById('installers_to_link');
    for (var i=0;i<fmobj.elements.length;i++) {
	var e = fmobj.elements[i];
	if (e.type=='checkbox') {
	    e.checked = false;
	}
    }
}


function checkAllFormCheckboxes(form) {    
    fmobj = document.getElementById(form);
    for (var i=0;i<fmobj.elements.length;i++) {
	var e = fmobj.elements[i];
	if (e.type=='checkbox') {
	    e.checked = true;
	}
    }
}

function unCheckAllFormCheckboxes(form) {    
    fmobj = document.getElementById(form);
    for (var i=0;i<fmobj.elements.length;i++) {
	var e = fmobj.elements[i];
	if (e.type=='checkbox') {
	    e.checked = false;
	}
    }
}


function ajax_autocomplete_installer_job_references(inst_id) {

    var xmlhttp;
    if (window.XMLHttpRequest)
	{
	    // code for IE7+, Firefox, Chrome, Opera, Safari
	    xmlhttp=new XMLHttpRequest();
	}
    else if (window.ActiveXObject)
	{
	    // code for IE6, IE5
	    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
    else
	{
	    alert("Your browser does not support XMLHTTP!");
	}
    xmlhttp.onreadystatechange=function()
	{
	    if(xmlhttp.readyState==4)
		{
		    res = xmlhttp.responseText;
		    //alert(res);
		    return "test";

		    //refs = res.split(",");


		}
	}

    xmlhttp.open("GET","../../ajax/get_installer_job_references.php?inst_id="+inst_id,true);
    xmlhttp.send(null);
}

function update_installer_job_status(job_id, inst_id)  {
    var xmlhttp;
    var select;
    var myvalue = 'undefined';
    
    select = document.getElementById("installer_job_status_"+job_id);
    myvalue = select.options[select.selectedIndex].value;
    
    if (myvalue == 'Please Select') { 
	return false;
    }
   
    if (window.XMLHttpRequest)  {
	// code for IE7+, Firefox, Chrome, Opera, Safari
	xmlhttp=new XMLHttpRequest();
    } else if (window.ActiveXObject) {
	// code for IE6, IE5
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    } else {
	alert("Your browser does not support XMLHTTP!");
   } 


    xmlhttp.onreadystatechange=function() {
	if(xmlhttp.readyState==4) {
	    var res = xmlhttp.responseText.split("::::");
	    if (res.length == 2) {
		document.getElementById('update_job_progress').innerHTML=res[0];
		window.location = res[1];
	    } else {
		document.getElementById('update_job_progress').innerHTML=xmlhttp.responseText;
	    }
	}
    }

    //alert("../ajax/update_installer_job_status.php?job_id="+job_id+"&inst_id="+inst_id+"&status_id="+myvalue);
    xmlhttp.open("get","../ajax/update_installer_job_status.php?job_id="+job_id+"&inst_id="+inst_id+"&status_id="+myvalue,true);
    xmlhttp.send(null);
}



function update_installer_intro_page(inst_id)  {
    var xmlhttp;
    var select;
    var page;
    
    if (document.getElementById('defautl_login').checked == true) {
	page = 'jbs';
    } else {
	page = 'int';
    }
    
   
    if (window.XMLHttpRequest)  {
	// code for IE7+, Firefox, Chrome, Opera, Safari
	xmlhttp=new XMLHttpRequest();
    } else if (window.ActiveXObject) {
	// code for IE6, IE5
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    } else {
	alert("Your browser does not support XMLHTTP!");
   } 


    xmlhttp.onreadystatechange=function() {
	if(xmlhttp.readyState==4) {
	}
    }

    //alert("../ajax/update_installer_intro_page.php?inst_id="+inst_id+"&page="+page);
    xmlhttp.open("get","../ajax/update_installer_intro_page.php?inst_id="+inst_id+"&page="+page,true);
    xmlhttp.send(null);
}




function update_installations_admin(id, type)  {
    var xmlhttp;
    var select;
    var myvalue = 'undefined';
    
    myvalue = document.getElementById(type+"_"+id).checked;

    if (window.XMLHttpRequest)  {
	// code for IE7+, Firefox, Chrome, Opera, Safari
	xmlhttp=new XMLHttpRequest();
    } else if (window.ActiveXObject) {
	// code for IE6, IE5
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    } else {
	alert("Your browser does not support XMLHTTP!");
   } 


    xmlhttp.onreadystatechange=function() {
	if(xmlhttp.readyState==4) {
	    document.getElementById('debug_output_message').innerHTML=xmlhttp.responseText;
	}
    }

    //alert("../ajax/update_installations_admin.php?id="+id+"&type="+type+"&value="+myvalue);
    xmlhttp.open("get","../ajax/update_installations_admin.php?id="+id+"&type="+type+"&value="+myvalue,true);
    xmlhttp.send(null);
}

      
function toggle_popups(hide_id, show_id) {
    var elem, vis;
    if(document.getElementById) {// this is the way the standards work
	elem_s = document.getElementById(show_id);
	elem_h = document.getElementById(hide_id);
    } else if(document.all) {// this is the way old msie versions work
	elem_s = document.all[show_id];
	elem_h = document.all[hide_id];
    } else if(document.layers) {// this is the way nn4 works
	elem_s = document.layers[show_id];
	elem_h = document.layers[hide_id];
    }
    elem_s.style.display = 'block';
    elem_h.style.display = 'none';
}

function get_window_width() {
    var viewportwidth;
    var viewportheight;
    
    if (typeof window.innerWidth != 'undefined') {
	// the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight  
	viewportwidth = window.innerWidth;
	viewportheight = window.innerHeight;
    } else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0) {
	// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
	viewportwidth = document.documentElement.clientWidth;
	viewportheight = document.documentElement.clientHeight;
    } else {
	// older versions of IE
        viewportwidth = document.getElementsByTagName('body')[0].clientWidth;
	viewportheight = document.getElementsByTagName('body')[0].clientHeight;
    }

    return viewportwidth;
}


// November 3, 2009, http://www.willmaster.com/
// Copyright 2009 Bontrager Connection, LLC
function AutoScrollOnload(from_left, from_top) {
    
    // Specify how many pixels from the left 
    //    and how many down from the top to 
    //    automatically scroll the page.    
    var InFromLeft = from_left;
    var DownFromTop = from_top;
    
    // No other customization required.
    
    window.scrollTo(InFromLeft,DownFromTop);
}


//===========================================================================================================================
//===========================================================================================================================
//===========================================================================================================================


popup_init();

function popup_init() {
    $(document).ready( function() {
	    $('.popup_outer').each(function() {
		    var $this = $(this);
		    //alert($this.children().html());
		    if ($this.HasBubblePopup() == false) {
			$this.CreateBubblePopup({
				position: 'top',
				    align: 'center',
				    innerHtml: $this.children().html(),
				    width:'300px',
				    innerHtmlStyle: {
				    color:'#000000', 
					'text-align':'center'
					},		
				    themeName:     'green',
				    themePath: 	'../images/jquery/jquerybubblepopup-theme'
				    });
		    }
		});
	});
}


function scroll_to(id) {
  $('html,body').animate({scrollTop: $("#"+id).offset().top},'slow');
}




