1 function ratings_showhide(oid
)
3 var e
= document
.getElementById(oid
);
4 if(e
.style
.display
== 'none') {
5 e
.style
.display
= 'block';
7 e
.style
.display
= 'none';
10 function ratings_getAjaxObj()
16 // Firefox, Opera 8.0+, Safari
17 xmlHttp
=new XMLHttpRequest();
24 xmlHttp
=new ActiveXObject("Msxml2.XMLHTTP");
30 xmlHttp
=new ActiveXObject("Microsoft.XMLHTTP");
42 function ratings_alertContents()
44 if (http_Request
.readyState
== 4) {
45 if (http_Request
.status
== 200) {
47 result
= http_Request
.responseXML
;
48 message
= result
.getElementsByTagName('message')[0];
50 error
= result
.getElementsByTagName('error')[0];
51 if (error
.textContent
== '0') {
57 document
.getElementById('ratings_ajaxmessages_' + objectid
).innerHTML
= '<a href="">' + message
.textContent
+ '</a>';
58 document
.getElementById('ratings_link_' + objectid
).innerHTML
= ' ';
62 document
.getElementById('ratings_ajaxmessages_' + objectid
).innerHTML
= message
.textContent
;
65 alert('There was a problem with the request.');
70 function ratings_sendcomment(url
, formid
, oid
)
75 http_Request
= getAjaxObj();
77 if (http_Request
==false)
82 // Construct parameters
83 frm
= document
.getElementById(formid
);
86 for(var i
= 0;i
< frm
.elements
.length
;i
++)
88 element
= frm
.elements
[i
];
92 if ((element
.type
=='radio') || (element
.type
=='checkbox'))
94 if (element
.checked
== true)
96 element_value
= element
.value
;
102 element_value
= element
.value
;
106 if (add_element
==true)
108 parameters
= parameters
+ element
.name
+"=" + encodeURI( element_value
) + "&";
113 http_Request
.onreadystatechange
= ratings_alertContents
;
114 http_Request
.open('POST', url
, true);
115 http_Request
.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
116 http_Request
.setRequestHeader("Content-length", parameters
.length
);
117 http_Request
.setRequestHeader("Connection", "close");
118 http_Request
.send(parameters
);