var oyunlar = '';
var sayac = 0;

function showstyle(){
   frm = document.forms.frmStyle;
   renk = frm.cmbStyle.options[frm.cmbStyle.selectedIndex].value;
   eval("document.resim.src = 'images/ornek/style" + renk + ".jpg'");
}
function generateCode(){
   var fHeight=44;
   var satir=0;
   var wide=0;
   frm = document.forms.frmStyle;
   formCode = document.forms.frmCode;
   sutun = frm.genislik.options[frm.genislik.selectedIndex].value;
   if (sutun==1){wide=107;}
   if (sutun==2){wide=198;}
   if (sutun==3){wide=289;}
   renk = frm.cmbStyle.value;
   satir = sayac / sutun;
   fHeight = fHeight + ((Math.ceil(satir)) * 57) + (4 * (Math.ceil(satir)-1)) ; 
   code='<div align="right" style="font-family:Verdana;font-size:10px;width:' + wide + 'px;">'
   code= code + '<iframe marginwidth="0" marginheight="0" frameborder="0" scrolling="no" width="' + wide + '" height="' + fHeight + '" src="http://www.oyunbox.com/iframe.asp?columns=' + sutun + '&style=' + renk + '&games=' + oyunlar + '"></iframe>\n'

   
   code= code + '<a style="color:#495370; text-decoration:none;" href="http://www.oyunekle.net">sitene ekle</a>  &raquo;\n' 
   
   if (sutun==1) {code = code + '<a style="color:#495370;text-decoration:none;" href ="http://www.oyunbox.net">oyun</a>\n';
   }else{code = code + '<a style="color:#495370;text-decoration:none;" href ="http://www.oyunbox.com">oyunlar</a>';}
   code = code + '</div>'
   
   formCode.txtCode.value =  code;
   formCode.txtCode.select();
//   return code;
}   
function setScrollPos(){
  window.scroll(scrOfX, scrOfY);
}

function collectGames(pOyun){
	if(String(oyunlar).indexOf('+' + pOyun + '+')<0){
			if(oyunlar.length>0){
				oyunlar = oyunlar +  pOyun + '+';
				sayac = sayac + 1;
			}else{
				oyunlar = oyunlar + '+' + pOyun + '+';
				sayac = sayac + 1;
			}	
	}else{
			oyunlar = oyunlar.replace('+' + pOyun , '');
			sayac = sayac - 1;
	}
}

function divContent(content){
var div = document.getElementById('Oyunlar');
if( div ){
var index;
index=div.innerHTML;
if(String(index).indexOf(content)<0){
			
		if(index.length<60){
		div.innerHTML = div.innerHTML + ' ' + content;
		}else{
		div.innerHTML = div.innerHTML + ', ' + content;
	}
	}else{
		div.innerHTML = div.innerHTML.replace(content + ",", "");
		div.innerHTML = div.innerHTML.replace(", " + content, "");
		div.innerHTML = div.innerHTML.replace(" " + content, "");
	}
}
}

function changeColor(id,id2) {
//Coloring
if (document.getElementById(id2).style.backgroundColor=='#ff6000' || String(document.getElementById(id2).style.backgroundColor)=='rgb(255, 96, 0)')
  {
  document.getElementById(id2).style.backgroundColor='transparent'; 
  document.getElementById(id).style.border='#000 1px solid';
  }else{
  document.getElementById(id2).style.backgroundColor='#ff6000'; 
  document.getElementById(id).style.border='#cc4e02 1px solid'; 
  document.getElementById(id2).style.color='red'; 
  document.getElementById(id).style.backgroundColor='#ffffff';  
  }
}

function init(){
	var stretchers = document.getElementsByClassName('box');
	var toggles = document.getElementsByClassName('tab');
	var myAccordion = new fx.Accordion(
		toggles, stretchers, {opacity: false, height: true, duration: 600}
	);
	//hash functions
	var found = false;
	toggles.each(function(h3, i){
		var div = Element.find(h3, 'nextSibling');
			if (window.location.href.indexOf(h3.title) > 0) {
				myAccordion.showThisHideOpen(div);
				found = true;
			}
		});
		if (!found) myAccordion.showThisHideOpen(stretchers[0]);
}
function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}
