function background_image_cache(fix) {
try {
document.execCommand("BackgroundImageCache", false, fix);
} catch(err) { }
}
function popup(id,w,h){
var x = ((screen.width-w)/2);
var y = ((screen.height-y)/2);
var popup = window.open(''+id,'','width='+w+',height='+h+',hotkeys=0,dependent=1,alwaysRaised=1,location=0,resizable=1,status=0,titlebar=0,toolbar=0,directories=0,menubar=0,scrollbars=1,left=' +x+',top=150');
}
function popup_ns(id,w,h) {
var x = ((screen.width-w)/2);
var y = ((screen.height-h)/2);
var popup = window.open(''+id,'','width='+w+',height='+h+',hotkeys=0,dependent=1,alwaysRaised=1,location=0,resizable=0,status=0,titlebar=0,toolbar=0,directories=0,menubar=0,scrollbars=0,left=' +x+',top='+y+'');
}
function confirmRequest(msg, url) {
if (confirm(msg)) {
location = url;
}
}
function fullscreen(theURL) {
window.open(theURL, '', 'width=1600, height=1150, fullscreen=yes, scrollbars=auto');
}
function click_info(){
var obj = $i('browsersupport');
var footer = $i('footer');
obj.style.display = (obj.style.display == 'none') ? 'block' : 'none';
footer.style.height = (obj.style.display == 'block') ? '110px' : '80px';
reorder_stageboxes();
scrollpage(document.body, 30);
}
function print_r(theObj){
var html = '';
if(theObj.constructor){
html+='
';
for(var p in theObj){
if(typeof(theObj[p]) == 'object'){
html+='- ['+p+'] => '+typeof(theObj)+'
';
html+='';
var inner = theObj[p];
for(var r in inner){
if(typeof(inner[r]) == 'object'){
var inf = inner[r];
html+='- ['+p+'] => '+typeof(theObj)+'
';
html+='';
html+=print_r2(inf);
html+='
';
} else {
html+='- ['+r+'] => '+inner[r]+' ('+typeof(inner[r])+')
';
}
}
html+='
';
} else {
html+='- ['+p+'] => '+theObj[p]+'
';
}
}
html+='
';
return html;
}
}
function print_r2(theObj){
var html = '';
if(theObj.constructor){
html+='';
for(var p in theObj){
if(typeof(theObj[p]) == 'object'){
html+='- ['+p+'] => '+typeof(theObj)+'
';
html+='';
var inner = theObj[p];
for(var r in inner){
html+='- ['+r+'] => '+inner[r]+' ('+typeof(inner[r])+')
';
}
html+='
';
} else {
html+='- ['+p+'] => '+theObj[p]+'
';
}
}
html+='
';
return html;
}
}
function change_background(object, color){
object.appendChild(new_div('selection', false, false));
var selector=$i('selection');
selector.style.position = 'absolute';
selector.style.width = object.offsetWidth + "px";
selector.style.height = object.offsetHeight + "px";
selector.style.top = 0;
selector.style.left = "-8px";
selector.style.borderRight = '8px solid #fff';
object_opacity(selector, 10);
var temp_color = object.style.backgroundColor;
var temp_function = object.onmouseover;
selector.onmouseover = function (){
object.onmouseover = function(){}
}
selector.onclick = function (){
object.removeChild(selector);
}
selector.onmouseout = function (){
object.removeChild(selector);
object.onmouseover = temp_function;
}
}
function blueprint() {
var width = window.innerWidth;
var height = window.innerHeight;
if(document.getElementById('dhtml_goodies_id' + divCounter).style.display == 'none'){
document.getElementById('dhtml_goodies_id' + divCounter).style.display = 'block';
} else {
fadeoutobject(document.getElementById('dhtml_goodies_id' + divCounter));
//document.getElementById('dhtml_goodies_id' + divCounter).style.display = 'none';
}
}
function setBGColor(id, hexc){
document.getElementById('' + id + '').style.backgroundColor = hexc;
}
function unsetBGColor(id, hexc){
document.getElementById(id).style.backgroundColor = hexc;
}
function closeme(){
opener.focus();
self.close();
}
function loadPage(id){
window.open(id, '_parent');
}
function listitem_highlite(obj, maxed){
if(obj){
for(var i=1;i<=maxed;i++){
var listitem_object = document.getElementById('listitem' + i);
listitem_highlite_force_off(listitem_object);
}
document.getElementById( 'listiteminner'+obj.getAttribute('name') ).className = 'select-label-black';
obj.style.backgroundColor='#ffffff';
obj.style.color='#305cb6';
}
}
function listitem_highlite_force_off(obj){
document.getElementById( 'listiteminner'+obj.getAttribute('name') ).className = 'select-label';
obj.style.backgroundColor='';
//obj.childNodes[1].style.backgroundColor='#ffffff';
obj.style.color='#ffffff';
}
function resetting_global_function_variables(){
/* this function appears in the frontend environment
* external calls, needs a global resetting, when a new page called.
*/
global_runtime = null
motion_sense = false;
item_pos = 1;
vgt_item_pos = 1;
pgt_item_pos = 1;
}
/* *************** slider **************** */
motion_sense = false;
var item_pos = 1;
var vgt_item_pos = 1;
var pgt_item_pos = 1;
function section_pos(id, move){
var obj = $i(id);
var childs = exclude_nodes(obj, '#text').childNodes;
var active = 0;
for(var i=0;childs.length>i;i++){
if(childs[i].className == 'active'){
active = i;
childs[i].className = 'inactive';
}
}
if(move == 'left' && active > 0){
childs[active-1].className = 'active';
} else if((move == 'right') && (active < (childs.length-1))){
childs[active+1].className = 'active';
} else {
childs[active].className = 'active';
}
}
function section_active(active, obj, group, SAMPLE_DST_OBJ, OBJ_ID, MAX_ITEMS){
//autoslide(SAMPLE_DST_OBJ, active, obj, MAX_ITEMS);
var childs = exclude_nodes($i(obj), '#text').childNodes;
var _obj = document.getElementById(OBJ_ID);
var sample = document.getElementById(SAMPLE_DST_OBJ);
var objpos = (_obj.style.right) ? eval(_obj.style.right.replace('px', '')) : 0;
var POS = active+1;
var inactive = 0;
var dist = eval(sample.offsetWidth) * active;
for(var i=0;childs.length>i;i++){
if(childs[i].className == 'active'){
inactive = i;
}
if(inactive != active){
childs[i].className = 'inactive';
}
}
var itempos = inactive+1;
if(motion_sense == false){
if(inactive != active){
childs[active].className = 'active';
var DRC = (active > inactive) ? 'left' : 'right';
var step = 0;
switch(DRC){
case 'left': step=POS-itempos; break;
case 'right': step=itempos-POS; break;
}
move_object(_obj, DRC, dist, 0, 11, 11);
}
}
}
function exclude_nodes(obj, nodename){
if(obj){
for(var i=0;obj.childNodes.length>i;i++){
if(obj.childNodes[i].nodeName == nodename){
obj.removeChild(obj.childNodes[i]);
}
}
return obj;
} else {
alert(error_message(1));
}
}
function display_tab(object, tabobject){
var obj = object;
/* reseting the channel pos */
var parent = exclude_nodes(obj.parentNode, '#text');
var tabs = exclude_nodes(tabobject.parentNode, '#text');
//alert(tabs.childNodes.length);
for(var i=0;parent.childNodes.length>i;i++){
//alert(parent.childNodes[i].id);
parent.childNodes[i].style.display = 'none';
tabs.childNodes[i].className = 'inactivetab';
}
obj.style.display = 'block';
tabobject.className = 'activetab';
}
function slide(SAMPLE_DST_OBJ, DRC, OBJ_ID, MAX_ITEMS, CUST_SPEED){
if(motion_sense == false){
if(!SAMPLE_DST_OBJ) alert('SAMPLE_DST_OBJ');
if(!DRC) alert('DRC');
if(!OBJ_ID) alert('OBJ_ID');
if(!MAX_ITEMS) alert('MAX_ITEMS');
var sample = document.getElementById(SAMPLE_DST_OBJ);
var speed = (CUST_SPEED) ? CUST_SPEED : 10;
if(client == 'ie'){
speed = speed/2;
}
var _obj = document.getElementById(OBJ_ID);
var rpos = (_obj.style.right) ? eval(_obj.style.right.replace('px', '')) : 0;
var sample_w = sample.offsetWidth;
var realpos = (DRC == 'left') ? (rpos / sample_w)+1 : (rpos / sample_w);
var dist = (DRC == 'left') ? sample.offsetWidth * realpos : sample.offsetWidth * (realpos-1);
//if(DRC == 'left') blu (sample.offsetWidth + ' * ' + realpos + ' = ' + dist);
//if(DRC == 'right') blu (sample.offsetWidth + ' * ' + (realpos-1) + ' = ' + dist);
var limit = sample.offsetWidth * MAX_ITEMS;
var cpu = 10;
var objpos = (_obj.style.right) ? eval(_obj.style.right.replace('px', '')) : 0;
var itempos = (objpos/dist)+1;
var realpos_reset = 0;
//blu(itempos + ';' + MAX_ITEMS);
if(((realpos < MAX_ITEMS) && (DRC == 'left')) || ((realpos > 0 && DRC == 'right'))){
if(motion_sense == false){
move_object(_obj, DRC, dist, limit, speed, cpu);
switch(DRC){
case 'left': realpos++; break;
case 'right': realpos; break;
}
var current_listitem_object = document.getElementById('listitem' + (realpos));
listitem_highlite(current_listitem_object, MAX_ITEMS);
}
} else {
if(motion_sense == false){
realpos = (DRC == 'left') ? 0 : MAX_ITEMS;
dist = (DRC == 'left') ? sample.offsetWidth * realpos : sample.offsetWidth * (realpos-1);
move_object(_obj, DRC, dist, limit, speed, cpu);
realpos_reset = (DRC == 'left') ? 1 : MAX_ITEMS;
current_listitem_object = document.getElementById('listitem' + (realpos_reset));
listitem_highlite(current_listitem_object, MAX_ITEMS);
}
}
}
}
function slide_normal(SAMPLE_DST_OBJ, DRC, OBJ_ID, MAX_ITEMS, CUST_SPEED, step, section_name){
if(!SAMPLE_DST_OBJ) alert('SAMPLE_DST_OBJ');
if(!DRC) alert('DRC');
if(!OBJ_ID) alert('OBJ_ID');
if(!MAX_ITEMS) alert('MAX_ITEMS');
var _obj = document.getElementById(OBJ_ID);
var sample = document.getElementById(SAMPLE_DST_OBJ);
var steps = (step) ? step : 1;
webaudit_hit();
var rpos = (_obj.style.right) ? eval(_obj.style.right.replace('px', '')) : 0;
var sample_w = sample.offsetWidth;
var realpos = (DRC == 'left') ? (rpos / sample_w)+1 : (rpos / sample_w);
var dist = (DRC == 'left') ? sample.offsetWidth * realpos : sample.offsetWidth * (realpos-1);
//if(DRC == 'left') blu (sample.offsetWidth + ' * ' + realpos + ' = ' + dist);
//if(DRC == 'right') blu (sample.offsetWidth + ' * ' + (realpos-1) + ' = ' + dist);
//var dist = eval(sample.offsetWidth) * steps;
var objpos = (_obj.style.right) ? eval(_obj.style.right.replace('px', '')) : 0;
var itempos = realpos;
var speed = (CUST_SPEED) ? CUST_SPEED : 10;
if(client == 'ie'){
speed = speed;
}
var limit = sample.offsetWidth * Math.round(MAX_ITEMS);
var cpu = 5;
if(((realpos < MAX_ITEMS) && (DRC == 'left')) || ((realpos > 0 && DRC == 'right'))){
if(motion_sense == false){
move_object(_obj, DRC, dist, limit, speed, cpu);
var reverse_drc = (DRC == 'right') ? 'left' : 'right';
section_pos(section_name, reverse_drc);
//var current_listitem_object = document.getElementById('listitem' + item_pos);
//listitem_highlite(current_listitem_object, MAX_ITEMS);
}
} else {
if(motion_sense == 'd'){
realpos = (DRC == 'left') ? 0 : MAX_ITEMS;
dist = (DRC == 'left') ? sample.offsetWidth * realpos : sample.offsetWidth * (realpos-1);
move_object(_obj, DRC, dist, limit, speed, cpu);
realpos_reset = (DRC == 'left') ? 1 : MAX_ITEMS;
current_listitem_object = document.getElementById('listitem' + (realpos_reset));
listitem_highlite(current_listitem_object, MAX_ITEMS);
}
}
}
function autoslide(SAMPLE_DST_OBJ, POS, OBJ_ID, MAX_ITEMS){
var sample = document.getElementById(SAMPLE_DST_OBJ);
var DRC = (POS > item_pos) ? 'left' : 'right';
var dist = eval(sample.offsetWidth) * (POS-1);
var speed = 1; //sudden swap for big distances
//alert('POS:'+ POS + ' item_pos:' + item_pos + ' DRC:' + DRC + ' dist:' +dist + ' sense:' + motion_sense);
var _obj = document.getElementById(OBJ_ID);
var _limit_obj = document.getElementById('safeframe');
var limit = _limit_obj.offsetWidth * MAX_ITEMS;
_obj.style.width = limit + 'px';
var cpu = 10;
if(motion_sense == false){
move_object(_obj, DRC, dist, limit, speed, cpu);
item_pos = POS;
var current_listitem_object = document.getElementById('listitem' + item_pos);
listitem_highlite(current_listitem_object, MAX_ITEMS);
}
}
function autoslide(SAMPLE_DST_OBJ, POS, OBJ_ID, MAX_ITEMS){
var sample = document.getElementById(SAMPLE_DST_OBJ);
var DRC = (POS > item_pos) ? 'left' : 'right';
var dist = eval(sample.offsetWidth) * (POS-1);
var speed = 1; //sudden swap for big distances
//alert('POS:'+ POS + ' item_pos:' + item_pos + ' DRC:' + DRC + ' dist:' +dist + ' sense:' + motion_sense);
var _obj = document.getElementById(OBJ_ID);
var _limit_obj = document.getElementById('safeframe');
var limit = _limit_obj.offsetWidth * MAX_ITEMS;
_obj.style.width = limit + 'px';
var cpu = 10;
if(motion_sense == false){
move_object(_obj, DRC, dist, limit, speed, cpu);
item_pos = POS;
var current_listitem_object = document.getElementById('listitem' + item_pos);
listitem_highlite(current_listitem_object, MAX_ITEMS);
}
}
var global_runtime = null;
function timeout_autoslide(object, SAMPLE_DST_OBJ, POS, OBJ_ID, MAX_ITEMS){
var temp_style = object.style.backgroundColor;
if (POS != item_pos) {
object.style.backgroundColor = '#66768b';
//document.getElementById('listiteminner'+POS).style = 'select-label-white';
}
if (global_runtime) window.clearInterval(global_runtime);
if (object.timeout_memory_flag) window.clearInterval(object.timeout_memory_flag);
var step = 0;
var length = 25;
object.timeout_memory_flag = window.setInterval(
function(){
// dummy ...
step++;
if(step>length){
window.clearInterval(object.timeout_memory_flag);
autoslide(SAMPLE_DST_OBJ, POS, OBJ_ID, MAX_ITEMS);
}
}, 10);
object.onmouseout = function(){
if(POS != item_pos) {
object.style.backgroundColor = temp_style;
//document.getElementById('listiteminner'+POS).style = 'select-label-black';
}
window.clearInterval(object.timeout_memory_flag);
}
global_runtime = object.timeout_memory_flag;
}
function clear_search_value(obj){
if(obj.value == 'Keresés ...'){
obj.value = '';
}
}
function submit_now(obj){
// not now :-)
}
function post_content_filter_form(){
var obj = document.forms['content_filter'];
var keyword = (obj.elements[0].value.replace('Keresés ...')) ? obj.elements[0].value.replace('Keresés ...') : false;
var channel_id = (obj.elements[1].value) ? obj.elements[1].value : false;
var year_from = obj.elements[2].value;
var month_from = obj.elements[3].value;
var day_from = (obj.elements[4].value.length == 1) ? '0' + obj.elements[4].value : obj.elements[4].value;
var date_in = year_from + month_from + day_from + '000000';
var year_until = obj.elements[5].value;
var month_until = obj.elements[6].value;
var day_until = (obj.elements[7].value.length == 1) ? '0' + obj.elements[7].value : obj.elements[7].value;
var date_out = year_until + month_until + day_until + '245959';
search_galleries(keyword, channel_id, date_in, date_out);
}
function post_searchcontent_filter_form(){
var obj = document.forms['content_filter'];
var keyword = (obj.elements[0].value.replace('Keresés ...')) ? ((ie6) ? obj.elements[0].value.replace('Keresés ...') : unescape(obj.elements[0].value.replace('Keresés ...'))) : false;
var channel_id = (obj.elements[1].value) ? obj.elements[1].value : false;
var year_from = obj.elements[2].value;
var month_from = obj.elements[3].value;
var day_from = (obj.elements[4].value.length == 1) ? '0' + obj.elements[4].value : obj.elements[4].value;
var date_in = year_from + month_from + day_from + '000000';
var year_until = obj.elements[5].value;
var month_until = obj.elements[6].value;
var day_until = (obj.elements[7].value.length == 1) ? '0' + obj.elements[7].value : obj.elements[7].value;
var date_out = year_until + month_until + day_until + '245959';
search_articles(keyword, channel_id, date_in, date_out);
}
var flash_width = 1024;
var flash_height = 768;
function highlight_item(object, chex){
var obj = object;
var temp_color = obj.style.backgroundColor;
obj.style.backgroundColor = (chex) ? chex : '#edf0f4';
obj.onmouseout = function(){
obj.style.backgroundColor = temp_color;
}
}
var bgkey = null;
function cross_bg(object, tchex, chex, key){
if(bgkey == null){
bgkey = key;
} else {
var last_obj = exclude_nodes(object.parentNode, '#text').childNodes[bgkey-1];
last_obj.style.backgroundColor = tchex;
}
var obj = object;
var t_color = (tchex) ? tchex.replace('#', '') : '000000';
var color = (chex) ? chex.replace('#', '') : 'ffffff';
var rgb = [hex2dec(color.substr(0,2)),hex2dec(color.substr(2,2)),hex2dec(color.substr(4,2))];
var t_rgb = [hex2dec(t_color.substr(0,2)),hex2dec(t_color.substr(2,2)),hex2dec(t_color.substr(4,2))];
var steps = 20;
var actStep = 0;
var powr = 1;
var r=0; var g=0; var b=0;
obj.animation = window.setInterval(
function(){
r = easeInOut(t_rgb[0],rgb[0],steps,actStep,powr);
g = easeInOut(t_rgb[1],rgb[1],steps,actStep,powr);
b = easeInOut(t_rgb[2],rgb[2],steps,actStep,powr);
obj.style.backgroundColor = "rgb("+r+","+g+","+b+")";
actStep++;
if (actStep > steps) {
window.clearInterval(obj.animation);
}
}, 10);
}
function submit_form(obj, link){
obj.action = link;
}
/* top-ajanlo */
var topajanlo_key = 0;
function topajanlo_thumb(key){
var last_key = topajanlo_key;
$i('clickpoint'+last_key).style.display = 'none';
$i('topajanlo_content'+last_key).style.display = 'none';
$i('clickpoint'+key).style.display = 'block';
$i('topajanlo_content'+key).style.display = 'block';
topajanlo_key = key;
/*
var object = $i('topajanlo_lead'+key);
var lead = object.innerHTML;
var power = 1;
var step = 0;
var length = lead.length;
object.timeout_memory_flag = window.setInterval(
function(){
// dummy ... minValue,maxValue,totalSteps,actualStep,powr
object.innerHTML = lead.substr(0, easeInOut(0,length,length,step,power));
step++;
if(step>length){
window.clearInterval(object.timeout_memory_flag);
object.innerHTML += '
'
}
}, 20);
*/
}
function topajanlo_slide(object, move_size){
webaudit_hit();
if(object.motion == undefined){
object.motion = true;
if (object.timeout_memory_flag) window.clearInterval(object.timeout_memory_flag);
object.step = 0;
var length = 10;
var startpos = (object.offsetLeft) ? object.offsetLeft : 0;
var endpos = startpos + move_size;
var phase = 0;
var max_phase = 2;
var prefix = '';
var power = 3;
object.timeout_memory_flag = window.setInterval(
function(){
// dummy ... minValue,maxValue,totalSteps,actualStep,powr
object.style.left = prefix + easeInOut(startpos,endpos,length,object.step,power) + 'px';
object.step++;
if(object.step>length){
phase++;
endpos = startpos;
startpos = eval(object.style.left.replace('px', ''));
power = 2;
length = 14;
object.step = 0;
}
if(phase == max_phase){
window.clearInterval(object.timeout_memory_flag);
object.motion = undefined;
}
}, 10);
}
}
function addListener(element, type, expression, bubbling)
{
bubbling = bubbling || false;
if(window.addEventListener) { // Standard
element.addEventListener(type, expression, bubbling);
return true;
} else if(window.attachEvent) { // IE
element.attachEvent('on' + type, expression);
return true;
} else return false;
}
function hex2dec(value){
var input = value.toUpperCase();
var hexa_range = '0123456789ABCDEF';
var equal = [];
for(var i=0;i ' + min_move_offset + ' - ' + max_move_offset);
if((pos > min_move_offset) && (pos < max_move_offset)){
object_move(content, offset*stepvalue, direction, visible_items);
}
}
function normalize(css_values){
return eval(css_values.replace('px', '').replace('pt', ''));
}
function object_move(object, move_size, direction, visible_items){
if(object.motion == undefined){
object.motion = true;
if (object.timeout_memory_flag) window.clearInterval(object.timeout_memory_flag);
var step = 0;
var length = 10;
var startpos = (object.style.left) ? eval(object.style.left.replace('px', '')) : 0;
var endpos = (direction == 'left') ? startpos - move_size : startpos + move_size;
var prefix = '';
var power = 3;
var lap = 0;
var position_object = ($i(object.id + '_pos0')) ? $i(object.id + '_pos0') : null;
object.timeout_memory_flag = window.setInterval(
function(){
// dummy ... minValue,maxValue,totalSteps,actualStep,powr
object.style.left = prefix + easeInOut(startpos,endpos,length,step,power) + 'px';
step++;
if(step>length){
window.clearInterval(object.timeout_memory_flag);
events[object.id] = object.style.left;
if(position_object){
lap = Math.abs(normalize(object.style.left));
var items = object.childNodes.length / visible_items;
for(var i=0;ilength){
active_child = null;
child.style.position = 'absolute';
child.style.visibility = 'hidden';
child.style.height = (openheight-20) + 'px';
allow_close = true;
window.clearInterval(object.scale_div_height_memory_flag);
}
}, interval);
}
} else {
var item = null;
for(var i=0; ilength){
allow_close = true;
object.style.height = (normalize(object.style.height)-20) + 'px';
window.clearInterval(object.scale_div_height_memory_flag);
}
}, interval);
}
function auto_close(){
if(allow_close == true && active_child){
active_child.style.display = 'none';
}
}
function highlight_menuitem(object, chex){
var obj = object;
var temp_color = obj.style.backgroundColor;
obj.style.backgroundColor = (chex) ? chex : '#edf0f4';
// if(allow_close == true){
obj.onmouseout = function(){
obj.style.backgroundColor = temp_color;
}
// }
}
var image_key = 0;
function swap_images(id, direction, key){
webaudit_hit();
var obj = $i(id);
var prev_key = (eval(image_key) > 0) ? eval(image_key)-1 : gallery_images.length-1;
var next_key = (eval(image_key)+1 < gallery_images.length) ? eval(image_key)+1 : '0';
var current_key = (direction && (direction == 'next')) ? next_key : prev_key;
if(key){
current_key = key;
}
for(var i=0;gallery_images.length>i;i++){
var itempos = $i('galeria_kepek_container_pos'+i);
itempos.className = (i==current_key) ? 'item active' : 'item inactive';
}
obj.style.backgroundImage = 'url(/cache/'+gallery_images[current_key]+')';
image_key = current_key;
$i('gallery_page').innerHTML = (eval(image_key)+1) + '/' + gallery_images.length;
}
var last_child = null;
function toggle_child(id, total, parent){
webaudit_hit();
var obj = $i(id);
var obj_height = obj.style.height.replace('pt', '').replace('px', '');
//blu(obj_height);
var state = (obj_height == 0) ? 'close' : 'open';
var openheight = obj.childNodes[0].offsetHeight;
//blu('a');
if(last_child == null){
last_child = obj;
for(var i=0;ilength){
var box = object.parentNode.parentNode.parentNode;
//box.parentNode.style.height = box.parentNode.offsetHeight + offset_end + 'px';
move_bottom_neighbours(box.parentNode);
window.clearInterval(object.scale_div_height_memory_flag);
}
}, interval);
}
function toggle_search_options(id){
var obj=$i(id);
obj.style.display = (obj.style.display == 'none') ? 'block' : 'none';
}
function count_chars(obj){
var max_char = 1000;
var char_len = obj.value.length;
if(char_len > max_char){
obj.value = obj.value.substr(0,max_char);
}
char_len = obj.value.length;
$i('chars').innerHTML = char_len + '/' +max_char + ' karakter';
}
var PHI = 1.61803398874989484820458683;
var PHI_INV = 1/PHI;
// This function multiplies a 4x4 matrix by a 4x1 vector
function multV(m,v0,v1,v2,v3) {
// Initialize the result vector.
var result = new Array(3);
// Perform the multiplication
result[0] = m[0][0]*v0 + m[0][1]*v1 + m[0][2]*v2 + m[0][3]*v3;
result[1] = m[1][0]*v0 + m[1][1]*v1 + m[1][2]*v2 + m[1][3]*v3;
result[2] = m[2][0]*v0 + m[2][1]*v1 + m[2][2]*v2 + m[2][3]*v3;
result[3] = m[3][0]*v0 + m[3][1]*v1 + m[3][2]*v2 + m[3][3]*v3;
return result;
}
// This funciton returns the identity matrix
function identity() {
return [[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];
}
// This class will represent a single stand-alone renderer.
function realspace(renderDiv, maxZ) {
if($i(renderDiv)){
// The div in which all will be drawn.
this.rField=$i(renderDiv);
// xCut is the maximum displayable z value.
if (maxZ) this.maxZ = maxZ;
else this.maxZ = 0;
// Find the coordinates of the canvas thing.
this.xPos = this.rField.style.left.substring(0,this.rField.style.left.indexOf("px"));
this.yPos = this.rField.style.top.substring(0,this.rField.style.left.indexOf("px"));
this.width = this.rField.offsetWidth;
this.height = this.rField.offsetHeight;
this.resetMatrix();
// This array will contain all the points to be drawn.
this.points = new Array();
} else {
setTimeout('init3d()', 100);
}
}
realspace.prototype.rotateX = rotateX;
realspace.prototype.rotateY = rotateY;
realspace.prototype.rotateZ = rotateZ;
realspace.prototype.scale = scale;
realspace.prototype.translate = translate;
realspace.prototype.addPoint = addPoint;
realspace.prototype.addPointV = addPointV;
realspace.prototype.clearPoints = clearPoints;
realspace.prototype.drawPoint = drawPoint;
realspace.prototype.paint = paint;
realspace.prototype.resetMatrix = resetMatrix;
realspace.prototype.addLine = addLine;
function resetMatrix() {
// translate the axes to the center of the canvas.
this.matrix = identity();
this.matrix = this.translate(this.width/2,this.height/2,0);
}
function rotateX(angle,m) {
if(!m) m = this.matrix;
var c = Math.cos(angle);
var s = Math.sin(angle);
return mult(m,[[1, 0, 0, 0],[0, c, -s, 0],[0, s, c, 0],[0, 0, 0, 1]]);
}
function rotateY(angle,m) {
if(!m) m = this.matrix;
var c = Math.cos(angle);
var s = Math.sin(angle);
return mult(m,[[c, 0, s, 0],[0, 1, 0, 0],[-s, 0, c, 0],[0, 0, 0, 1]]);
}
function rotateZ(angle,m) {
if(!m) m = this.matrix;
var c = Math.cos(angle);
var s = Math.sin(angle);
return mult(m,[[c, -s, 0, 0],[s, c, 0, 0],[0, 0, 1, 0],[0, 0, 0, 1]]);
}
function scale(scaleX,scaleY,scaleZ,m) {
if(!m) m = this.matrix;
return mult(m,[[scaleX,0,0,0],[0,scaleY,0,0],[0,0,scaleZ,0],[0,0,0,1]]);
}
function translate(dX, dY, dZ,m) {
if(!m) m = this.matrix;
return mult(m,[[1,0,0,dX],[0,1,0,dY],[0,0,1,dZ],[0,0,0,1]]);
}
function addPoint(x,y,z,text,m) {
if(!m) m=identity();
var v = multV(m,x,y,z,1);
var l = this.points.length;
this.points[l]=new Point(v[0],v[1],v[2],text);
this.rField.appendChild(this.points[l].div);
return this.points[l];
}
function addPointV(v,text) {
this.addPoint(v[0],v[1],v[2],text);
}
function clearPoints() {
for (var i = 0; i this.width ||
tPoint[1] < 0 ||
tPoint[1] > this.height ||
tPoint[2] >= this.maxZ) {
this.points[index].div.style.visibility = "hidden";
return;
}
this.points[index].div.style.visibility = "visible";
this.points[index].div.style.left=tPoint[0]+"px";
this.points[index].div.style.top=tPoint[1]+"px";
//this.points[index].div.style.fontSize =5000/(-tPoint[2])+"px";
//this.points[index].div.style.zIndex = -tPoint[0]*2;
}
// This function paints each point onto the screen.
function paint() {
for(var i = 0; i'); }
for(var i=0;i'); }
for(var i=0;i'); }
for(var i=0;i'); }
}
canvas.paint();
loop();
}
function graphic(){
this.image_width = 100;
this.image_height = 100;
this.stage = $i('canvas');
this.textures = new Array(
'http://dtv.was.demoscene.tv/was/app/demoscenetv/14/402.gif',
'http://www.photoshopstar.com/wp-content/uploads/2008/02/texture-stock-added.jpg',
'http://pawgblog.files.wordpress.com/2007/12/denisemilani4.jpg',
'http://k53.pbase.com/u26/fatyellowlab/upload/43879554.100X100.jpg'
);
}
function core(){
var poly_space = 10;
var poly_cord = null;
for(var i=0;i<2;i++){
poly_cord = (graphic.image_width + poly_space)*i;
graphic.addPolygon(poly_cord,1);
}
graphic.addMaterial('textureMapping', $i('p0'));
graphic.addMaterial('textureMapping', $i('p1'));
play_test();
}
var calc = 0;
function play_test(){
if(calc < 12){
graphic.rotateObject($i('p0'), calc);
graphic.rotateObject($i('p1'), calc);
calc++;
setTimeout('play_test()', 10);
} else {
calc = 0;
}
}
function rotateObject(obj, degree){
this.objectVertex = obj.childNodes;
//obj.style.border = '1px solid red';
this.depth = 20;
this.angle = degree/360;
this.depth_aspect_height = graphic.image_height-(graphic.image_height*this.angle);
this.fieldWidth = graphic.image_width-(graphic.image_width*this.angle);
for(var i=0;i