var changeable_sizes = new Array("80%", "100%", "120%");
var subcategories = new Array();
var isIE = false;
var isOther = false;
var isNS4 = false;
var isNS6 = false;
var view_image = '';

var displayed_favourite = new Array();
displayed_favourite.favourite = 1;
displayed_favourite.recents = 1;
var favourites = new Array();
favourites.favourite = new Array();
favourites.recents = new Array();

var image_url = '/goklikk/images/';
browser_check();
function browser_check()
{
	if(document.getElementById)
	{
		if(!document.all)
		{isNS6=true;}
		if(document.all)
		{isIE=true;}
	}
	else
	{
		if(document.layers)
		{isNS4=true;}
		else
		{isOther=true;}
	}
}

function Elem(ID)
{
	browser_check();
	var element;
	if(isIE)
	{
		element = eval("document.all." + ID);
	}
	if(isNS6)
	{
		element = eval("document.getElementById('" + ID + "')");
	}
	if(isNS4)
	{
		element = eval("document." + ID);
	}
	if(isOther)
	{
		element = "null";
		alert("-[Error]-\nDue to your browser you will probably not\nbe able to view all of the following page\nas it was designed to be viewed. We regret\nthis error sincerely.");
	}
	return element;
}


function display_by_checkbox(chkboxElem, boxName)
{
	if (chkboxElem.checked == true)
	{
		if (Elem(boxName))
		{
			Elem(boxName).style.display='block';
		}
	}
	else
	{
		if (Elem(boxName))
		{
			Elem(boxName).style.display='none';
		}
	}
}
function display_box(box)
{
	if (Elem(box) && Elem(box).style.display == 'none') {
  	Elem(box).style.display = 'block';
  	if (Elem(box + '_img')) {
  		Elem(box + '_img').src = image_url + 'filter_minus.gif';
  	}
		return 1;
  }
  else {
  	Elem(box).style.display = 'none';
  	if (Elem(box + '_img')) {
  		Elem(box + '_img').src = image_url + 'filter_plus.gif';
  	}
		return 0;
  }
}
function show_box(box,show)
{
	if (Elem(box))
	{
		if (show == true) {
			Elem(box).style.display = 'block';
			if (Elem(box+'_img')){
				Elem(box+'_img').src=image_url+'filter_minus.gif';
			}
		}
		else {
			Elem(box).style.display = 'none';
			if (Elem(box+'_img')){
				Elem(box+'_img').src=image_url+'filter_plus.gif';
			}
		}
	}
}


function show_image(file_name, product_id, comment_pos)
{
	if (Elem('product_image'))
	{
		Elem('product_image').src = "show_images.php?file_name="+file_name+"&product_id="+product_id+"&cropped=false&max_x=320&cropped=false";
		if (Elem('product_image_comment'))
		{
			if (images_comment[comment_pos] && images_comment[comment_pos].length > 0)
			{
				Elem('product_image_comment').innerHTML = images_comment[comment_pos];
			}
			else
			{
				Elem('product_image_comment').innerHTML = default_comment;
			}
		}
	}
	//&max_y=243
	
}

/*
function show_box(id)
{
	if (Elem(id))
	{
		if (Elem(id).style.display == 'none')
		{
			Elem(id).style.display = 'block';
		}
		else
		{
			Elem(id).style.display = 'none';
		}
	}
}

function are_you_sure_delete()
{
	return confirm("Biztosan törölni szeretnéd?");
}


function set_image(image_id, file_name, ifx, ify,cropped)
{
	if(Elem(image_id))
	{
		Elem(image_id).src="show_images.php?file_name="+file_name+"&ifx="+ifx+"&ify="+ify+"&cropped="+cropped;
	}

}

function open_popup(location,id,width,height)
{
	window.open(location,id,"width="+width+",height="+height+",scrollbars=no,menubar=no,status=no,titlebar=no,resizeable=no")
}

function open_popup2(location,id,width,height)
{
	window.open(location,id,"width="+width+",height="+height+",scrollbars=yes,menubar=no,status=no,titlebar=no,resizeable=no")
}

function resize_heading_contents(heading_position)
{
	if($('heading_left_'+heading_position) && $('heading_right_'+heading_position))
	{
		var left_height = $('heading_left_'+heading_position).getHeight();
		var right_height = $('heading_right_'+heading_position).getHeight();

		if (left_height > right_height)
		{
			$('heading_right_'+heading_position).setStyle({height: (left_height-10)+"px"});
		}
		else
		{
			$('heading_left_'+heading_position).setStyle({height: (right_height-10)+"px"});
		}
	}
}
function resize_content_box(source_content, target_content)
{
	if($(target_content) && $(source_content))
	{
		var left_height = $(target_content).getHeight();
		var right_height = $(source_content).getHeight();

		if (left_height > right_height)
		{
			$(source_content).setStyle({height: (left_height-20)+"px"});
		}
		else
		{
			$(target_content).setStyle({height: (right_height-20)+"px"});
		}
	}
}
function change_style(size_id)
{
	if (size_id < changeable_sizes.length)
	{
		var font_change_elements = $$('.changeable_fontsized_content');
		for (var i = 0; i < font_change_elements.length; i++)
		{
			font_change_elements[i].setStyle({fontSize: changeable_sizes[size_id]});
		}
	}
	//$('article_content').style.fontsize = "150%";
}



function GeneratePassword() {
    
    if (parseInt(navigator.appVersion) <= 3) { 
        alert("Sorry this only works in 4.0 browsers"); 
        return true; 
    }
    
    var length=8;
    var sPassword = "";
    //length = document.aForm.charLen.options[document.aForm.charLen.selectedIndex].value;
    
    var noPunction = true//;(document.aForm.punc.checked);
    var randomLength = false;//(document.aForm.rLen.checked);
    
    if (randomLength) { 
        length = Math.random(); 
        length = parseInt(length * 100);
        length = (length % 7) + 6
    }
    
    
    for (i=0; i < length; i++) {
    
        numI = getRandomNum();
        if (noPunction) { while (checkPunc(numI)) { numI = getRandomNum(); } }
        
        sPassword = sPassword + String.fromCharCode(numI);
    }
    
    if (Elem('generated_password'))
    {
			Elem('generated_password').value = sPassword;
    }
    if (Elem('user_pass'))
    {
			Elem('user_pass').value = sPassword;
    }
    if (Elem('user_pass_retype'))
    {
			Elem('user_pass_retype').value = sPassword;
    }
    
    return true;
}

function check_main_panels_size()
{
	var mleft = $('mleft').getHeight();
	var mright = $('mright').getHeight();
	if (mleft > mright)
	{
		var rheight = (mleft - mright)-10;
		$('right_spacer').setStyle({height: rheight+'px', display: 'block'});
		$('left_spacer').setStyle({height: "0px", display: 'none'});
	}
	else
	{
		var lheight = (mright - mleft)-10;
		$('left_spacer').setStyle({height: lheight+'px', display: 'block'});
		$('right_spacer').setStyle({height: "0px", display: 'none'});
		
	}
}

function getRandomNum() {
    // between 0 - 1
    var rndNum = Math.random()
    // rndNum from 0 - 1000    
    rndNum = parseInt(rndNum * 1000);
    // rndNum from 33 - 127        
    rndNum = (rndNum % 94) + 33;
    return rndNum;
}

function checkPunc(num)
{
  if ((num >=33) && (num <=47)) { return true; }
  if ((num >=58) && (num <=64)) { return true; }    
  if ((num >=91) && (num <=96)) { return true; }
  if ((num >=123) && (num <=126)) { return true; }
  return false;
}
*/