var addthis_pub = "GoAutoMedia";
var addthis_brand = "GoAuto.com.au";
var addthis_header_color = "#ffffff";
var addthis_header_background = "#006699";
var addthis_offset_top = 0;
var addthis_offset_left = -220;
var addthis_hover_delay = 300;


function setCookie(name, value, expires) {
 document.cookie = name + '=' + escape(value) + '; path=/' +
 ((expires==null) ? '' : '; expires=' +
   expires.toGMTString( ));
}

function newWindow(where, width, height){
var width = (width!="") ? 'width='+width : 'width=820';
var height = (height!="" ) ? 'height='+height : 'height=600' ; 
var options = '820' +','+ '600'+ ',resizable=yes,toolbar,scrollbars,location,menubar,status,directories';
var db = 'http://www.infoonet.com';
var url = '/'+ where;
popupWin=window.open(url,'newWindow',options);
popupWin.moveTo(10,10);
popupWin.focus();
}

function goGoGadgetSubmit() {
	if (searchBlank()) popup();
}

function searchBlank() {
var doc = document.forms["search"];
if (doc.textfield.value == '' ) {
	alert ("Please enter some text to search for");
	doc.textfield.focus();
	return false
	}
return true
}

function searchFocus() {
	if (this.value=='Search') {
		this.value='';
	}
}



function category(control) {
 cat=control.options[control.selectedIndex].text;
 window.location.href='newmodels_' + escape(cat) + '?OpenDocument&amp;category=' + escape(cat)
}


// Search code

function popup() {
 form = document.forms.search;

 URL =  '/' + document.forms[0].db.value + '/storysearch?SearchView&amp;Query=' + escape(form.textfield.value);

//REMOVED THIS CODE FROM THE NEXT STATEMENT
// +AND+NOT+FIELD+type=RT+AND+NOT+FIELD+type=tips+AND+NOT+FIELD+type=events+AND+NOT+FIELD+type=glossary

if(form.type.value=='news' | form.type.value=='future' | form.type.value=='RT' | form.type.value=='home') {
  URL += '';
 }
 else if (form.type.value!='home') {
  URL += '';
 }

 URL +=  "&amp;Start=1&amp;Count=30&amp;SearchMax=60&amp;SearchOrder=4";
//alert(URL);
window.location.href=URL;
}



function popupSearch() {
 form = document.forms.form1;
 var incand = false;

 URL = '/' + document.forms[0].db.value + '/storysearch?SearchView&amp;Query='
 if (form.textfield.value  != '') {
   URL += escape(form.textfield.value);
   incand = true;
 }
 if (form.SearchMake.selectedIndex&gt;0) {
  if (incand) URL += '+AND+';
  URL += 'FIELD+make=' + escape(form.SearchMake.options[form.SearchMake.selectedIndex].text);
  incand = true;
 }
 if (form.SearchModel.selectedIndex&gt;0) {
  if (incand) URL += '+AND+';
  URL += 'FIELD+model=' + escape(form.SearchModel.options[form.SearchModel.selectedIndex].text);
 }
 if (form.type.value=='RT') {
  URL += '+AND+FIELD+type=RT' }
 else if(form.type.value=='news' | form.type.value=='home') {
  URL += '+AND+NOT+FIELD+type=RT+AND+NOT+FIELD+type=tips+AND+NOT+FIELD+type=events+AND+NOT+FIELD+type=glossary';
 }
 else if (form.type.value!='home') {
  URL += '+AND+FIELD+type=' + escape(form.type.value);
 }
 URL +=  "&amp;Start=1&amp;Count=15&amp;SearchMax=0&amp;SearchOrder=4";
//alert(URL);
window.location.href=URL;
}




function genericPopup(uri) {
var popupWin;
  URL = 'http://'+uri;
  wheight =  "480";
  wwidth =  "640";
  opts = 'width=' + wwidth + ',height=' + wheight + ',resizable,scrollbars=auto,left=20, top=20';
popupWin=window.open( '','Window', opts);
//alert(popupWin.name);
//var x = popupWin.focus();
popupWin.document.write("");
popupWin.document.write("    ");
popupWin.document.write("");
popupWin.focus();
}


function continueTheSearch() {
 form = document.forms.search;
 options = '';
  //alert("forms.type.value="+forms.type.value);
 URL = 'storysearch?SearchView&amp;Query=' + escape(form.textfield.value);
  if (form.type.value=='RT') {
  URL += '+AND+FIELD+type=RT' }
  else if(form.type.value=='news' | form.type.value=='home') {
  URL += '+AND+NOT+FIELD+type=RT+AND+NOT+FIELD+type=tips+AND+NOT+FIELD+type=events+AND+NOT+FIELD+type=glossary';
}

/*
// else if (form.type.value!='home' &amp;&amp; form.type.value=='' ) {
//  URL += '+AND+FIELD+type=' + escape(form.type.value);
 //}
*/

 else if (form.type.value=='' || form.type.value==null ) {
 URL = 'storysearch?SearchView&amp;Query=' + escape(form.textfield.value);
 } else {
   URL += '+AND+FIELD+type=' + form.type.value }

// if ( form.perPage.value ) options += "&amp;Count="+form.perPage.value;
// if ( form.searchMax.value!="snooty" ) options += "&amp;SearchMax="+form.searchMax.value;
// if ( form.searchFuzzy.checked ) options += "&amp;SearchFuzzy=1";
// if ( form.searchWv.checked ) options += "&amp;SearchWv=1";
// if ( form.searchOrder.value ) options += "&amp;SearchOrder="+form.searchOrder.value;
 URL +=  "&amp;Start=1&amp;Count=15&amp;SearchMax=0&amp;SearchOrder=4"+options;
//alert(URL + "\n\n" + form.searchMax.value+ "\n\n form.type.value is " + form.type.value);
window.location.href=URL;
}





////Vote////

//Send Form
function sendForm(){
 document.forms[0].submit(); 
}

//Access
function getPag(pag){
 parent.bra_cont.location.href = pag; 
}

//Resize
function resizeIframe() {
 alt = document.getElementById("Content");
 frm = parent.document.getElementById("ifpage");
 bod = parent.document.body;
 
 frm.height = alt.offsetHeight; 
}
