

function isUndefined(variable) {
				return typeof variable == 'undefined' ? true : false;
			};

function unlockIgnored(msgNum) {
	if (is_ie) {
		$gid('ListTopic'+msgNum).style.display = 'block';
		$gid('IgnoredTopic'+msgNum).style.display = 'none';
	} else {
		$gid('IgnoredTopic'+msgNum+'').innerHTML = $gid('ListTopic'+msgNum+'').innerHTML;
		$gid('ListTopic'+msgNum+'').innerHTML = '';
		$gid('ListTopic'+msgNum+'').id = 'exListTopic'+msgNum;
		$gid('IgnoredTopic'+msgNum+'').id = 'ListTopic'+msgNum;
	}
}



function unlockKlasik() {
	 $gid('klasikeditor').style.visibility = 'visible';
	 $gid('PostMessage').style.visibility = 'visible';
}

function toggleClassicEditor(messageId) { 
	
 	if (tinyMCE.getInstanceById(messageId)) {
		wysiwyg = 0;
 		tinyMCE.execCommand('mceRemoveControl', true, messageId);
 		document.getElementById('standarteditor').className = '';
 		document.getElementById('klasikeditor').className = 'current';
 		document.getElementById('klasikdugmeler').className = 'klasikdugmelerigoster';
	}
}

function toggleStandardEditor(messageId) { 
	
		if (!tinyMCE.getInstanceById(messageId)) {
			wysiwyg = 1;
 				tinyMCE.execCommand('mceAddControl', true, messageId); 
 			document.getElementById('standarteditor').className = 'current';
 			document.getElementById('klasikeditor').className = '';
 			document.getElementById('klasikdugmeler').className = 'klasikdugmelerigizle';
		}
	} 
	

function unlockAktif(msgNum) {
	if (is_ie) {
		$gid('aktifkonu'+msgNum).style.display = 'block';
		$gid('IgnoredTopic'+msgNum).style.display = 'none';
	} else {
		$gid('IgnoredTopic'+msgNum+'').innerHTML = $gid('aktifkonu'+msgNum+'').innerHTML;
		$gid('aktifkonu'+msgNum+'').innerHTML = '';
		$gid('aktifkonu'+msgNum+'').id = 'exListTopic'+msgNum;
		$gid('IgnoredTopic'+msgNum+'').id = 'aktifkonu'+msgNum;
	}
}

function autoReload()	{ 	document.ReloadFrm.submit()		}
function SetLastDate()	{	document.LastDateFrm.submit()	}
function jumpTo(s)	{	if (s.selectedIndex != 0) location.href = s.options[s.selectedIndex].value;return 1;}

function getAJresults(strURL,elId) 
{
var xmlHttp;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    try
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    catch (e)
      {
      alert("Tarayiciniz AJAX desteklemiyor");
      return false;
      }
    }
  }
  xmlHttp.onreadystatechange=function()
    {
    if(xmlHttp.readyState==4)
      {
      if (elId != '') {
      	var res = trim(xmlHttp.responseText);
      	if (res.length > 1) {
      		document.getElementById(elId).innerHTML=xmlHttp.responseText;
      	}
      }
      }
    }
  xmlHttp.open("GET",strURL,true);
  xmlHttp.send(null);
}


var mode;
var lang = new Array();
var userAgent = navigator.userAgent.toLowerCase();
var is_opera = userAgent.indexOf('opera') != -1 && opera.version();
var is_webkit = userAgent.indexOf('webkit') != -1;
var is_moz = (navigator.product == 'Gecko') && userAgent.substr(userAgent.indexOf('firefox') + 8, 3);
var is_ie = (userAgent.indexOf('msie') != -1 && !is_opera) && userAgent.substr(userAgent.indexOf('msie') + 5, 3);
var is_mac = userAgent.indexOf('mac') != -1;
var re;
if(isUndefined(codecount)) var codecount = '-1';
if(isUndefined(codehtml)) var codehtml = new Array();
	
	wysiwyg = parseInt(mode);
	if(!(is_ie || is_moz || (is_opera >= 9))) {
		allowswitcheditor = wysiwyg = 0;
	}
	if ($gid('klasikeditor')) {
		var bbcodemode = $gid('klasikeditor');
	}
	if ($gid('standarteditor')) {
		var wysiwygmode = $gid('standarteditor');
	}
	

//Array.prototype.push = function(value) {
//	this[this.length] = value;
//	return this.length;
//}

function checkall(form, prefix, checkall) {
	var checkall = checkall ? checkall : 'chkall';
	for(var i = 0; i < form.elements.length; i++) {
		var e = form.elements[i];
		if(e.name && e.name != checkall && (!prefix || (prefix && e.name.match(prefix)))) {
			e.checked = form.elements[checkall].checked;
		}
	}
}

function doane(event) {
	e = event ? event : window.event;
	if(is_ie) {
		e.returnValue = false;
		e.cancelBubble = true;
	} else if(e) {
		e.stopPropagation();
		e.preventDefault();
	}
}

function fetchCheckbox(cbn) {
	return $gid(cbn) && $gid(cbn).checked == true ? 1 : 0;
}

function getcookie(name) {
	var cookie_start = document.cookie.indexOf(name);
	var cookie_end = document.cookie.indexOf(";", cookie_start);
	return cookie_start == -1 ? '' : unescape(document.cookie.substring(cookie_start + name.length + 1, (cookie_end > cookie_start ? cookie_end : document.cookie.length)));
}

function thumbImg(obj) {
	var zw = obj.width;
	var zh = obj.height;
	if(is_ie && zw == 0 && zh == 0) {
		var matches
		re = /width=(["']?)(\d+)(\1)/i
		matches = re.exec(obj.outerHTML);
		zw = matches[2];
		re = /height=(["']?)(\d+)(\1)/i
		matches = re.exec(obj.outerHTML);
		zh = matches[2];
	}
	obj.resized = true;
	obj.style.width = zw + 'px';
	obj.style.height = 'auto';
	if(obj.offsetHeight > zh) {
		obj.style.height = zh + 'px';
		obj.style.width = 'auto';
	}
	if(is_ie) {
		var imgid = 'img_' + Math.random();
		obj.id = imgid;
		setTimeout('try {if ($gid(\''+imgid+'\').offsetHeight > '+zh+') {$gid(\''+imgid+'\').style.height = \''+zh+'px\';$gid(\''+imgid+'\').style.width = \'auto\';}} catch(e){}', 1000);
	}
	obj.onload = null;
}

function imgzoom(obj) {}

function in_array(needle, haystack) {
	if(typeof needle == 'string' || typeof needle == 'number') {
		for(var i in haystack) {
			if(haystack[i] == needle) {
					return true;
			}
		}
	}
	return false;
}

function setcopy(text, alertmsg){
	if(is_ie) {
		clipboardData.setData('Text', text);
		alert(alertmsg);
	} else if(prompt('Press Ctrl+C Copy to Clipboard', text)) {
		alert(alertmsg);
	}
}

function isUndefined(variable) {
	return typeof variable == 'undefined' ? true : false;
}

function mb_strlen(str) {
	var len = 0;
	for(var i = 0; i < str.length; i++) {
		len += str.charCodeAt(i) < 0 || str.charCodeAt(i) > 255 ? (charset == 'utf-8' ? 3 : 2) : 1;
	}
	return len;
}

function setcookie(cookieName, cookieValue, seconds, path, domain, secure) {
	var expires = new Date();
	expires.setTime(expires.getTime() + seconds);
	document.cookie = escape(cookieName) + '=' + escape(cookieValue)
		+ (expires ? '; expires=' + expires.toGMTString() : '')
		+ (path ? '; path=' + path : '/')
		+ (domain ? '; domain=' + domain : '')
		+ (secure ? '; secure' : '');
}
function uzman(replyid,replyrating,elId) {
	getAJresults("/forum/ajaxuzman.html?hpqyanit="+replyid + "&rating="+ replyrating,elId);
}

function kontrolKayit(varValid,varDiv) {
	getAJresults("/forum/ajaxkayit.html?"+varValid,varDiv);	
	var ajCmd = "$('#" + varDiv + "').hide('slow');$gid('"+varDiv+"').innerHTML = '';$('#" + varDiv + "').show('slow');"
	setTimeout(ajCmd,5000,'');
}

function strlen(str) {
	return (is_ie && str.indexOf('\n') != -1) ? str.replace(/\r?\n/g, '_').length : str.length;
}

function updatestring(str1, str2, clear) {
	str2 = '_' + str2 + '_';
	return clear ? str1.replace(str2, '') : (str1.indexOf(str2) == -1 ? str1 + str2 : str1);
}

function toggle_collapse(objname, noimg) {
	var obj = $gid(objname);
	obj.style.display = obj.style.display == '' ? 'none' : '';
	if(!noimg) {
		var img = $gid(objname + '_img');
		img.src = img.src.indexOf('_yes.gif') == -1 ? img.src.replace(/_no\.gif/, '_yes\.gif') : img.src.replace(/_yes\.gif/, '_no\.gif')
	}
	var collapsed = getcookie('discuz_collapse');
	collapsed =  updatestring(collapsed, objname, !obj.style.display);
	setcookie('discuz_collapse', collapsed, (collapsed ? 86400 * 30 : -(86400 * 30 * 1000)));
}

function trim(str) {
	return (str + '').replace(/(\s+)$/g, '').replace(/^\s+/g, '');
}

function _attachEvent(obj, evt, func) {
	if(obj.addEventListener) {
		obj.addEventListener(evt, func, false);
	} else if(obj.attachEvent) {
		obj.attachEvent("on" + evt, func);
	}
}

function openWindow(url) {
	popupWin = window.open(url,'new_page','width=400,height=400')
}
function openWindow2(url) {
	popupWin = window.open(url,'new_page','width=400,height=450')
}
function openWindow3(url) {
	popupWin = window.open(url,'new_page','width=400,height=450,scrollbars=yes')
}
function openWindow4(url) {
	popupWin = window.open(url,'new_page','width=400,height=525')
}
function openWindow5(url) {
	popupWin = window.open(url,'new_page','width=450,height=525,scrollbars=yes,toolbars=yes,menubar=yes,resizable=yes')
}
function openWindow6(url) {
	popupWin = window.open(url,'new_page','width=500,height=450,scrollbars=yes')
}
function openWindow7(url) {
	popupWin = window.open(url,'new_page','width=550,height=250')
}
function openWindow8(url) {
	popupWin = window.open(url,'smile','width=280,height=350')
}
function openWindow9(url) {
	popupWin = window.open(url,'new_page','width=400,height=200')
}


function openWindowHelp(url) {
	popupWin = window.open(url,'new_page','width=470,height=200,scrollbars=yes')
}
function toggleEditor(id) {
	if (!tinyMCE.get(id)){
		tinyMCE.execCommand('mceAddControl', false, id);
	}
	else
	{
		tinyMCE.execCommand('mceRemoveControl', false, id);
	}
}

function frmimgLoad(imgName, imgWidth) {
	var Img = new Image(); 
	var imgWidth = parseInt(imgWidth);
	Img.onload = function() {
		if (Img.width > imgWidth || Img.width != imgName.width) { 
				imgName.className = 'moimage';
				imgName.onclick = function() { 
				frmimgZoom(imgName,Img.width,Img.height); 
			};
		}
	}
	Img.src = imgName.src;
}


function frmimgZoom(imgName,imgx,imgy) {
	if (imgName.className == 'moimage') { 
		var myScreenX = document.body.offsetWidth - 80;
		var myScreenY = document.body.offsetHeight - 80;
		if (imgy > myScreenY) { Finaly = myScreenY; } else { Finaly = imgy; }
		if (imgx > myScreenX) { Finalx = myScreenX; } else { Finalx = imgx; }
		$(top).openDOMWindow({ 
		height:Finaly + 4, 
		width:Finalx + 2, 
		windowSourceURL: '/forum/zoom.html?src='+encodeURIComponent(imgName.src) + "&w=" + imgx + "&h=" + imgy,
		windowSource:'iframe', 
		overlayOpacity: '70',
		overlayBGColor: '#ffffff',
		windowPadding:10, 
		loader:1, 
		modal:0,
		loaderImagePath:'/images/as/ajax-loader.gif', 
		loaderHeight:16, 
		loaderWidth:17
		}); 
		return false;
		
		
		//if (imgx > (myScreenX-100) && imgy > (myScreenY-100)) {
		//	window.open('/forum/zoom.html?src='+encodeURIComponent(imgName.src),'Resim','resizable=yes,scrollbars=yes,Width='+ (myScreenX-100) +',Height='+ (myScreenY-100)); 
		//} 
		//else {
		//	window.open('/forum/zoom.html?src='+encodeURIComponent(imgName.src),'Resim','Width='+imgx+',Height='+imgy); 
		//}
	}
}

function kodSec(a)
{
	// Kod Satırının ID'si
	var e = a.parentNode.parentNode.getElementsByTagName('CODE')[0];
	
	// IE değilse
	if (window.getSelection)
	{
		var s = window.getSelection();
		// Safari
		if (s.setBaseAndExtent)
		{
			s.setBaseAndExtent(e, 0, e, e.innerText.length - 1);
		}
		// Firefox ve Opera
		else
		{
			var r = document.createRange();
			r.selectNodeContents(e);
			s.removeAllRanges();
			s.addRange(r);
		}
	}
	// Bazı eski browserlar
	else if (document.getSelection)
	{
		var s = document.getSelection();
		var r = document.createRange();
		r.selectNodeContents(e);
		s.removeAllRanges();
		s.addRange(r);
	}
	// IE
	else if (document.selection)
	{
		var r = document.body.createTextRange();
		r.moveToElementText(e);
		r.select();
	}
}


function spoilerSec(a)
{
	// Spoiler Satırının ID'si
	var e = a.parentNode.parentNode.getElementsByTagName('DIV')[0];
	if (e.style.display == 'block' ) {
		e.style.display = 'none';
		a.innerHTML = 'Göster';
	} else {
		e.style.display = 'block';
		a.innerHTML = 'Gizle';
	}
}

function checkall(form, prefix, checkall) {
	var checkall = checkall ? checkall : 'chkall';
	for(var i = 0; i < form.elements.length; i++) {
		var e = form.elements[i];
		if(e.name && e.name != checkall && (!prefix || (prefix && e.name.match(prefix)))) {
			e.checked = form.elements[checkall].checked;
		}
	}
}


function tubeVid(divId,vidURL,kalite)
{
	var vidx = getVidx();
	var vidy = getVidy() + 32;
	var so = new SWFObject('/images/chiptube.swf','mpl',vidx,vidy,'10,0,0,0'); 
	var videoYukle = vidURL + "%26kalite%3D" + kalite;
	so.addVariable('height',vidy); 
	so.addVariable('width',vidx); 
	so.addParam('allowfullscreen','true');  
	so.addParam('wmode','opaque');  
	so.addVariable('smoothing','true');
	so.addVariable('image', encodeURIComponent(vidURL)); 
	so.addVariable('file', videoYukle); 
	so.addVariable('bufferlength','3');
	so.addVariable('autostart','false');
	so.write(divId.parentNode);
}

function chipVid(divId,vidURL,kalite)
{
	var vidx = getVidx();
	var vidy = getVidy() + 32;
	var so = new SWFObject('/images/chipplayer.swf','mpl',vidx,vidy,'10,0,0,0'); 
	var videoYukle = vidURL + "%26kalite%3D" + kalite;
	so.addVariable('height',vidy); 
	so.addVariable('width',vidx); 
	so.addParam('allowfullscreen','true');  
	so.addParam('wmode','opaque');  
	so.addVariable('smoothing','true');
	so.addVariable('file', vidURL); 
	so.addVariable('bufferlength','3');
	so.addVariable('autostart','false');
	so.write(divId.parentNode);
}

function chipgenelvid(divId,vidURL,kalite)
{
	var vidx = getVidx();
	var vidy = getVidy() + 32;
	var so = new SWFObject('/images/chipgenelvideo.swf','mpl',vidx,vidy,'10,0,0,0'); 
	var videoYukle = vidURL;
	so.addVariable('height',vidy); 
	so.addVariable('width',vidx); 
	so.addParam('allowfullscreen','true');  
	so.addParam('wmode','opaque');  
	so.addVariable('smoothing','true');
	so.addVariable('file', vidURL); 
	so.addVariable('bufferlength','3');
	so.addVariable('autostart','false');
	so.write(divId.parentNode);
}

function chumVid(divId,vidURL,kalite)
{
	var vidx = getVidx();
	var vidy = getVidy() + 32;
	var videoYukle = "" + vidURL + "";
	var so = new SWFObject('/images/chipch.swf','mpl',vidx,vidy,'10,0,0,0'); 
	newVidURL = vidURL.split("/");
	newVidURL = newVidURL[1];
	so.addVariable('height',vidy); 
	so.addVariable('width',vidx); 
	so.addParam('allowfullscreen','true');  
	so.addParam('wmode','opaque');  
	so.addVariable('smoothing','true');
	so.addVariable('file', videoYukle);
	so.addVariable('bufferlength','3');
	so.addVariable('autostart','false');
	so.write(divId.parentNode);
}

function getZaman() {
	var simdi = newDate();
	var t_min = simdi.getMinutes();
	var t_newmin = 0;
	if (t_min < 15) { t_newmin = 0; }
	if (t_min > 14 && t_min < 30) { t_newmin = 15; }
	if (t_min > 29 && t_min < 45) { t_newmin = 30; }
	if (t_min > 44 && t_min < 60) { t_newmin = 45; }
	var t_mon = simdi.getMonth();
	if (t_mon < 10) { t_mon = "0" + t_mon; }
	var t_day = simdi.getDate();
	if (t_day < 10) { t_day = "0" + t_day; }
	var t_hour = simdi.getHours();
	if (t_hour < 10) { t_hour = "0" + t_hour; }
	if (t_newmin < 10) { t_newmin = "0" + t_newmin; }
	
	return '&tarih=' + simdi.getFullYear() + '' + t_mon + '' + t_day + '' + t_hour + '' + t_newmin + '00';
}

//function dmVid(divId,vidURL,kalite)
//{
//	var vidx = getVidx();
//	var vidy = getVidy() + 32;
//	var so = new SWFObject('/images/chipmotion.swf','mpl',vidx,vidy,'10,0,0,0'); 
//	var videoYukle = vidURL + "%26kalite%3D" + kalite + encodeURIComponent(getZaman);
//	so.addVariable('height',vidy); 
//	so.addVariable('width',vidx); 
//	so.addParam('allowfullscreen','true');  
//	so.addParam('wmode','opaque');  
//	so.addVariable('smoothing','true');
//	so.addVariable('image', encodeURIComponent(vidURL)); 
//	so.addVariable('file', videoYukle); 
//	so.addVariable('bufferlength','3');
//	so.addVariable('autostart','false');
//	so.write(divId.parentNode);
//}

function dmVid(divId,vidURL,kalite)
{
	var vidx = getVidx();
	var vidy = getVidy() + 32;
	var so = new SWFObject('http://195.8.215.137/swf/'+vidURL,'mpl',vidx,vidy,'10,0,0,0'); 
	var videoYukle = vidURL + "%26kalite%3D" + kalite + encodeURIComponent(getZaman);
	so.addVariable('height',vidy); 
	so.addVariable('width',vidx); 
	so.addParam('allowfullscreen','true');  
	so.addParam('wmode','opaque');  
	so.addVariable('image', encodeURIComponent(vidURL)); 
	so.addVariable('file', videoYukle); 
	so.addVariable('bufferlength','3');
	so.addVariable('autoPlay','0');
	so.write(divId.parentNode);
}




function sevenVid(divId,vidURL,kalite)
{
	var vidx = getVidx();
	var vidy = getVidy() + 32;
	var so = new SWFObject('/images/7load.swf','mpl',vidx,vidy,'10,0,0,0'); 
	var videoYukle = vidURL + "%26kalite%3D" + kalite;
	so.addVariable('height',vidy); 
	so.addVariable('width',vidx); 
	so.addParam('allowfullscreen','true');  
	so.addParam('wmode','opaque');  
	so.addVariable('smoothing','true');
	so.addVariable('image', encodeURIComponent(vidURL)); 
	so.addVariable('file', videoYukle); 
	so.addVariable('bufferlength','3');
	so.addVariable('autostart','false');
	so.write(divId.parentNode);
}

function izleseneVid(divId,vidURL,kalite)
{
	var vidx = getVidx();
	var vidy = getVidy() + 32;
	var so = new SWFObject('http://www.izlesene.com/embedplayer.swf?video=' + vidURL,'mpl',vidx,vidy,'10,0,0,0'); 
	so.addVariable('height',vidy); 
	so.addVariable('width',vidx); 
	so.addParam('allowfullscreen','true');  
	so.addParam('wmode','opaque');  
	so.addVariable('smoothing','true');
	so.addVariable('bufferlength','3');
	so.addVariable('autostart','false');
	so.write(divId.parentNode);
}


function akVid(divId,vidURL,kalite)
{
	var vidx = getVidx();
	var vidy = getVidy() + 32;
	var so = new SWFObject('/images/chipakilli.swf','mpl',vidx,vidy,'10,0,0,0'); 
	var videoYukle = vidURL;
	so.addVariable('height',vidy); 
	so.addVariable('width',vidx); 
	so.addParam('allowfullscreen','true');  
	so.addParam('wmode','opaque');  
	so.addVariable('smoothing','true');
	so.addVariable('file', videoYukle); 
	so.addVariable('bufferlength','3');
	so.addVariable('autostart','false');
	so.write(divId.parentNode);
}

function faceVid(divId,vidURL,kalite)
{
	var vidx = getVidx();
	var vidy = getVidy() + 32;
	var so = new SWFObject('/images/chipbook.swf','mpl',vidx,vidy,'10,0,0,0'); 
	var videoYukle = vidURL + "%26kalite%3D" + kalite;
	so.addVariable('height',vidy); 
	so.addVariable('width',vidx); 
	so.addParam('allowfullscreen','true');  
	so.addParam('wmode','opaque');  
	so.addVariable('smoothing','true');
	so.addVariable('file', videoYukle); 
	so.addVariable('bufferlength','3');
	so.addVariable('autostart','false');
	so.write(divId.parentNode);
}


function eksenVid(divId,vidURL,kalite)
{
	var vidx = getVidx();
	var vidy = getVidy() + 32;
	var so = new SWFObject('/images/chipeksen.swf','mpl',vidx,vidy,'10,0,0,0'); 
	var videoYukle = vidURL + "%26kalite%3D" + kalite;
	so.addVariable('height',vidy); 
	so.addVariable('width',vidx); 
	so.addParam('allowfullscreen','true');  
	so.addParam('wmode','opaque');  
	so.addVariable('smoothing','true');
	so.addVariable('file', videoYukle); 
	so.addVariable('bufferlength','3');
	so.addVariable('autostart','false');
	so.write(divId.parentNode);
}

function cafeVid(divId,vidURL,kalite)
{
	var vidx = getVidx();
	var vidy = getVidy() + 32;
	var so = new SWFObject('/images/chipcafe.swf','mpl',vidx,vidy,'10,0,0,0'); 
	var videoYukle = vidURL + "%26kalite%3D" + kalite;
	so.addVariable('height',vidy); 
	so.addVariable('width',vidx); 
	so.addParam('allowfullscreen','true');  
	so.addParam('wmode','opaque');  
	so.addVariable('smoothing','true');
	so.addVariable('image', encodeURIComponent(vidURL)); 
	so.addVariable('file', videoYukle); 
	so.addVariable('bufferlength','3');
	so.addVariable('autostart','false');
	so.write(divId.parentNode);
}

function gVid(divId,vidURL,kalite)
{
	var vidx = getVidx();
	var vidy = getVidy() + 32;
	var so = new SWFObject('/images/chipgvideo.swf','mpl',vidx,vidy,'10,0,0,0'); 
	so.addVariable('height',vidy); 
	so.addVariable('width',vidx); 
	so.addParam('allowfullscreen','true');  
	so.addParam('wmode','opaque');  
	so.addVariable('smoothing','true');
	so.addVariable('stretching','fill');
	so.addVariable('link','=' + vidURL);
	so.addVariable('image',encodeURIComponent("=" + vidURL));
	so.addVariable('file', encodeURIComponent("=" + vidURL + "%26kalite%3D" + kalite));
	so.addVariable('bufferlength','3');
	so.addVariable('autostart','false');
	so.write(divId.parentNode);
}

function meoVid(divId,vidURL,kalite)
{
	var vidx = getVidx();
	var vidy = getVidy() + 32;
	var so = new SWFObject('/images/chipmeo.swf','mpl',vidx,vidy,'10,0,0,0'); 
	so.addVariable('height',vidy); 
	so.addVariable('width',vidx); 
	so.addParam('allowfullscreen','true');  
	so.addParam('wmode','opaque');  
	so.addVariable('smoothing','true');
	so.addVariable('stretching','fill');
	so.addVariable('link','=' + vidURL);
	so.addVariable('image',vidURL);
	so.addVariable('file', encodeURIComponent(vidURL + "%26kalite%3D" + kalite));
	so.addVariable('bufferlength','3');
	so.addVariable('autostart','false');
	so.write(divId.parentNode);
}

function yahooVid(divId,vidURL,kalite)
{
	var vidx = getVidx();
	var vidy = getVidy() + 32;
	var so = new SWFObject('/images/chiphoo.swf','mpl',vidx,vidy,'10,0,0,0'); 
	newVidURL = vidURL.split("/");
	newVidURL = newVidURL[1];
	if (!newVidURL) {
		newVidURL = vidURL;
	}	
	so.addVariable('height',vidy); 
	so.addVariable('width',vidx); 
	so.addParam('allowfullscreen','true');  
	so.addParam('wmode','opaque');  
	so.addVariable('smoothing','true');
	so.addVariable('file', encodeURIComponent('http://media.chip.com.tr/players/yahoo.php?v=' + newVidURL + "%26kalite%3D" + kalite));
	so.addVariable('bufferlength','3');
	so.addVariable('autostart','false');
	so.write(divId.parentNode);
}

function yahooVid2(divId,vidURL,kalite)
{
	var vidx = getVidx();
	var vidy = getVidy() + 32;
	var so = new SWFObject('http://d.yimg.com/static.video.yahoo.com/yep/YV_YEP.swf?ver=2.2.40','mpl',vidx,vidy,'10,0,0,0'); 
	newVidURL = vidURL.split("/");
	newVidURL = newVidURL[1];
	if (!newVidURL) {
		newVidURL = vidURL;
	}	
	so.addVariable('height',vidy); 
	so.addVariable('width',vidx); 
	so.addParam('allowfullscreen','true');  
	so.addParam('wmode','opaque');  
	so.addVariable('smoothing','true');
	so.addVariable('link',	'http://video.yahoo.com/watch/' + vidURL);
	so.addVariable('image', newVidURL);
		so.addVariable('id', vidURL.split("/")[1]);
	so.addVariable('vid', vidURL.split("/")[0]);
	//so.addVariable('file', encodeURIComponent(newVidURL + "%26kalite%3D" + kalite));
	so.addVariable('bufferlength','3');
	so.addVariable('autostart','false');
	so.write(divId.parentNode);
}

function engelliYanit(nums) {
	$gid('h'+nums).style.display = 'none';
	$gid('r'+nums).style.display = 'block';
	$gid('r'+nums).style.width = '100%';
}


function openPollWindow(url,w,h) {
	popupWin = window.open(url,'new_page','width='+w+',height='+h+',scrollbars=yes')
}
function submitPoll(btnPressed) {
	btnPressed.disabled=true;
	if (btnPressed.name == "results") {
		document.Poll.Method_Type.value = "guest_vote";
	} else {
		document.Poll.Method_Type.value = "member_vote";
	}
	document.Poll.submit();
}

function anketartieksi(val) {
	//sonYanit
	//maxYanit
	// newYanit
	var yeniYanit = sonYanit + val;
	if (yeniYanit > sonYanit && yeniYanit < (maxYanit+1)) {
		$gid('anketresult'+sonYanit).className = 'blok';
		$gid('anketresult'+yeniYanit).className = 'bloklast';
		sonYanit = yeniYanit;
	} else if (yeniYanit < sonYanit && yeniYanit > 1) {
		$gid('answer'+sonYanit).value = '';
		$gid('anketresult'+sonYanit).className = 'gizli';
		$gid('anketresult'+yeniYanit).className = 'bloklast';
		sonYanit = yeniYanit;
	}		
	
}

function chkBlogFolder(ioName) {
	var newString = ioName.value;
	if (newString) {
		opTxt = new String(newString.toLowerCase());
		opTxt = opTxt.replace("İ","i");
		opTxt = opTxt.replace("ı","i");
		opTxt = opTxt.replace("Ş","s");
		opTxt = opTxt.replace("ş","s");
		opTxt = opTxt.replace("Ğ","g");
		opTxt = opTxt.replace("ğ","g");
		opTxt = opTxt.replace("Ü","u");
		opTxt = opTxt.replace("ü","u");
		opTxt = opTxt.replace("Ç","c");
		opTxt = opTxt.replace("ç","c");
		opTxt = opTxt.replace("Ö","o");
		opTxt = opTxt.replace("ö","o");
		opTxt = opTxt.replace("_","");
		opTxt = opTxt.replace(" ","");
		opTxt = opTxt.replace(/\W/g,'')
		
		ioName.value = opTxt;	
	}

}

function chkBlogOnay(el) {
	
	chkBlogFolder(el.folder); 
	
	if (el.folder.value.length < 3) { 
		alert('Blog adresinizin uzunluğu 3 karakterden kısa olamaz'); 
		return false;
	} 
	if (!el.sozlesme.checked) {
		alert('Blog oluşturabilmek için kullanıcı sözleşmesini okumanız ve kabul etmeniz gerekmektedir'); 
		return false;
	}
	if (confirm(el.folder.value + ' adresinde bir blog sayfanız oluşturulmak üzeredir.\n\nBu adres daha sonra değiştirilemez. Onaylıyor musunuz?')) {
		el.submit();
	}
	
}
var objYil, objAy, objGun, intLen, intYil, intAy, intGun;
arrDays=[31,28,31,30,31,30,31,31,30,31,30,31];
dtNow = new Date();

function tarihKontrol(yil, ay, gun) {
	objYil = document.getElementById(yil);
	objAy = document.getElementById(ay);
	objGun = document.getElementById(gun);
	
	
	
	intYil = parseInt(objYil.options[objYil.selectedIndex].value);
	intAy = parseInt(objAy.options[objAy.selectedIndex].value);
	intGun = parseInt(objGun.options[objGun.selectedIndex].value);
	
	intLen = arrDays[intAy-1];
	
	if (intAy == 2 && intLen == 28 && intYil%4 == 0 && !(intYil%100 == 0 && intYil%400 != 0)) {
				intLen++;
	}
	
	if (intGun > intLen) {
		objGun.selectedIndex = intLen - 1;
	}
	
}

function chkParola(bname, fname) {
	if ($gid('parolaold').value.length < 1) { 
		alert('Lütfen şu anda kullandığınız parolanızı girin');
		return false;
	}
	if ($gid('parolanew').value.length < 5) { 
		alert('Lütfen yeni parolanızı girin. Yeni parolanız 5 karakterden kısa olamaz');
		return false;
	}
	if ($gid('parolanew2').value.length < 5) { 
		alert('Lütfen yeni parolanızı 2. alanda da girin. Yeni parolanız 5 karakterden kısa olamaz');
		return false;
	}
	if ($gid('parolanew').value != $gid('parolanew2').value) {
		alert('Yeni girmiş olduğunuz parolalar birbiriyle uyuşmuyor. Yeni parolalarınız kontrol edin');
		return false;
	}
	bname.disabled = true;
	var form1 = fname;
	form1.submit();
	
}

function chkPosta(bname, fname) {
	if ($gid('parolaold').value.length < 1) { 
		alert('Lütfen şu anda kullandığınız parolanızı girin');
		return false;
	}
	if ($gid('emailnew').value != $gid('emailnew2').value) {
		alert('Yeni girmiş olduğunuz e-posta adresleri birbiriyle aynı değil. Doğruluğunu lütfen kontrol edin');
		return false;
	}
	if (	$gid('emailnew').value == $gid('emailold').value ) {
		alert('E-Postanız zaten aktif e-postanız ile aynı. Değişiklikler kaydedilmeyecek');
		return false;
	}
	
	var matches;
	re = /([_a-z0-9-]+(\.[_a-z0-9-]+)*@[^\s]+(\.[a-z0-9-]+)*(\.[a-z]{2,4}))/i
	matches = re.exec($gid('emailnew').value);
	if (matches != null) {
		if ($gid('emailnew').value != matches[0]) {
			alert('E-Postanızın geçerli bir e-posta olduğuna emin misiniz?');
			return false;
		}
	} else {
			alert('E-Postanızın geçerli bir e-posta olduğuna emin misiniz?');
			return false;
	}
		
	
	bname.disabled = true;
	var form1 = fname;
	form1.submit();
	
}

function chkKullanici(bname, fname) {
	if ($gid('parolaold').value.length < 1) { 
		alert('Lütfen şu anda kullandığınız parolanızı girin');
		return false;
	}
	if ($gid('usernew').value != $gid('usernew2').value) {
		alert('Yeni girmiş olduğunuz kullanıcı adları birbiriyle aynı değil. Doğruluğunu lütfen kontrol edin');
		return false;
	}
	
	bname.disabled = true;
	var form1 = fname;
	form1.submit();
	
}

function chkPostaCaps(ioName) {
	var newString = ioName.value;
	if (newString) {
		opTxt = new String(newString.toLowerCase());
		opTxt = opTxt.replace("İ","i");
		opTxt = opTxt.replace("ı","i");
		opTxt = opTxt.replace("Ş","s");
		opTxt = opTxt.replace("ş","s");
		opTxt = opTxt.replace("Ğ","g");
		opTxt = opTxt.replace("ğ","g");
		opTxt = opTxt.replace("Ü","u");
		opTxt = opTxt.replace("ü","u");
		opTxt = opTxt.replace("Ç","c");
		opTxt = opTxt.replace("ç","c");
		opTxt = opTxt.replace("Ö","o");
		opTxt = opTxt.replace("ö","o");
		opTxt = opTxt.replace(/[\s]/g,'')
		opTxt = opTxt.replace(/[[^@\._-]\W]/g,'')
		ioName.value = opTxt;	
	}
}

function setAvatar(avId,avURL,avExtras) {
	var avurl = avURL;
	if (confirm('Bu resmi avatarınız olarak seçmek istiyor musunuz?')) {
		var now = new Date(); var nIndex = now.getTime();
		getAJresults("/forum/ajaxavatar.html"+avExtras+"avid="+avId + "&nindex=" + nIndex,'');
	
		$gid('avatarDiv').style.backgroundImage = 'url("'+avurl+'")';		
	}
}

function setBlogStil(avId,avExtras) {
	
	if (confirm('Blog başlık stilinizin bu olmasını mi istiyorsunuz?')) {
		var now = new Date(); var nIndex = now.getTime();
		getAJresults("/forum/ajaxblogstil.html"+avExtras+"avid="+avId + "&nindex=" + nIndex,'stil'+avId);
		var ajCmd = "$('#stil" + avId + "').hide('slow')";
		setTimeout(ajCmd,5000,'');
	}
}



function permaLink(vtopic,vreply) {
	if (vreply != 0) {
		var vradd = "_r" + vreply;
		var question = "Bu yanıta bağlantı"
	} else {
		var vradd = "";
		var question = "Bu konuya bağlantı"
	}
	prompt(question,'http://www.chip.com.tr/forum/konu_t'+vtopic+vradd+'.html');	
}

function bildir(vtopic,vreply) {
		$(top).openDOMWindow({ 
		height:300, 
		width:450, 
		positionType:'centered',
		windowSourceURL: '/forum/pop_bildir.html?TOPIC_ID=' + vtopic + '&REPLY_ID=' + vreply,
		windowSource:'iframe', 
		overlayOpacity: '70',
		overlayBGColor: '#ffffff',
		windowPadding:0, 
		loader:0, 
		modal:1,
		loaderImagePath:'/images/as/ajax-loader.gif', 
		loaderHeight:16, 
		loaderWidth:17
		}); 
		return false;
}

function postSil(vstring) {
		$(top).openDOMWindow({ 
		height:250, 
		width:580, 
		positionType:'centered',
		windowSourceURL: '/forum/pop_delete.html?' + vstring,
		windowSource:'iframe', 
		overlayOpacity: '70',
		overlayBGColor: '#ffffff',
		windowPadding:0, 
		loader:0, 
		modal:1,
		loaderImagePath:'/images/as/ajax-loader.gif', 
		loaderHeight:16, 
		loaderWidth:17
		}); 
		return false;
}

function vidClassCheck(fId) {
	var myown = document.location.href;
	if (myown.indexOf('/forum/') != -1 || (myown.indexOf('/kisisel/') != -1 && myown.indexOf('/defter.html') != -1)) {
		fId.parentNode.className = 'forumvideo';
	} else {
		fId.parentNode.className = 'externalvideo';
	}
}

function getVidx() {
	var myown = document.location.href;
	if (myown.indexOf('/forum/') != -1 || (myown.indexOf('/kisisel/') != -1 && myown.indexOf('/defter.html') != -1)) {
		return 576;
	} else {
		return 448;
	}
}

function getVidy() {
	var myown = document.location.href;
	if (myown.indexOf('/forum/') != -1 || (myown.indexOf('/kisisel/') != -1 && myown.indexOf('/defter.html') != -1)) {
		return 324;
	} else {
		return 252;
	}
}

function ilgiliForumKonu(strtitle) {
	getAJresults("/forum/ajaxtopics.html?title="+ encodeURIComponent(strtitle),"relTopics");
}

function blogkategoriduzenle(strId) {
	$(".inputz").hide();
	$(".baslikz").show();
	$(".baslikz" + strId).toggle();
}
