﻿
var currentSize;
var currentStyle;
var currentStatus;

function toggleFonts() {
	
	var elementOne = document.getElementById("articleBody");
	var targetElement = elementOne.getElementsByTagName("p");
	//alert(targetElement.length)
	//alert(targetElement[3].innerHTML)
	if (currentSize == "large") {
		for (var i=0; i<targetElement.length; i++) {
			targetElement[i].style.fontSize = "1.1em";
			targetElement[i].style.lineHeight = "1.3em";
		}
		currentSize = "small";
	} else {
		for (var i=0; i<targetElement.length; i++) {
			targetElement[i].style.fontSize = "1.4em";
			targetElement[i].style.lineHeight = "1.5em";
		}
		currentSize = "large";
	}
}

function toggleFontsStripHTML() {
	var inTag = false;
	var elementOne = document.getElementById("articleBody");
	var targetElement = elementOne.getElementsByTagName("p");
	if (currentSize == "large") {
		for (var i=0; i<targetElement.length; i++) {
			for(var j = 0; j < targetElement[i].innerHTML.length; j++) {
		        if(targetElement[i].innerHTML.charAt(j) == '<') inTag = true;
		        if(targetElement[i].innerHTML.charAt(j) == '>') {
		              inTag = false;
		              j++;
		        }
		   
		        if(!inTag) {
		        	//targetElement[i].innerHTML.charAt(j).style.fontSize = "1.1em";
		        	//targetElement[i].innerHTML.charAt(j).style.lineHeight = "1.3em";
		        }
		   }
		}
		currentSize = "small";
	} else {
		for (var i=0; i<targetElement.length; i++) {
			for(var j = 0; j < targetElement[i].innerHTML.length; j++) {
		        alert(targetElement[i].innerHTML.charAt(j));
		        if(targetElement[i].innerHTML.charAt(j) == '<') inTag = true;
		        if(targetElement[i].innerHTML.charAt(j) == '>') {
		              inTag = false;
		              j++;
		        }
		   
		        if(!inTag) {
		        	//targetElement[i].innerHTML.charAt(j).style.fontSize = "1.4em";
		        	//targetElement[i].innerHTML.charAt(j).style.lineHeight = "1.5em";
		        }
		   }
		}
		currentSize = "large";
	}
}

function toggleStyle() {
	
	var targetElement = document.getElementById("articleBody");
	var pElement = targetElement.getElementsByTagName("p");
	//var atargetElement = targetElement.getElementsByTagName("a");
	var atargetElement = document.getElementById("aLinkTeyxos");
	//var atargetElement = targetElement.getElementsByTagName("a")(12)
	var bqElement = targetElement.getElementsByTagName("blockquote");
	
	if (currentStyle == "enhanced") {
		targetElement.style.backgroundColor = "#ffffff";
		targetElement.style.color = "#000000";
		//atargetElement.style.color = "#000000";
		if (atargetElement){
			atargetElement.setAttribute("style","color:#000000");			
		}
		currentStyle = "normal";
	} else {
		targetElement.style.backgroundColor = "#000000";
		targetElement.style.color = "#ffffff";
		//atargetElement.style.color = "#ffffff";
		if (atargetElement){

			atargetElement.style.color = "#ffffff";
			//atargetElement.setAttribute("style","text-color:#ffffff");
			
		}
		currentStyle = "enhanced";
	}
}

function toggleComments() {
	
	var elementOne = document.getElementById("replyAllComments");
	var toggleLink = document.getElementById("toggleComments");
	
	if (currentStatus == "open") {
		elementOne.style.display = "none";
		elementOne.style.visibility = "hidden";
		currentStatus = "closed";
		toggleLink.innerHTML = "<strong>+ </strong><a href='javascript:toggleComments();'>Διαβάστε όλες τις απόψεις</a>";
	} else {
		elementOne.style.display = "block";
		elementOne.style.visibility = "visible";
		currentStatus = "open";
		toggleLink.innerHTML = "<strong>- </strong><a href='javascript:toggleComments();'>Κλείστε τις απόψεις</a>";
	}
}

function displayContent (type, content) {
	var display = document.getElementById("display");
	if (display){
		if ( type == "pic") {
			displayC = "<img src='"+content+"' />";
		}
		if ( type == "vid") {
			
//displayC = 'AC_FL_RunContent('
//displayC = displayC + "codebase", "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0",
//displayC = displayC + "width", "185",
//displayC = displayC + "height", "250",
//displayC = displayC + "src", "player",
//displayC = displayC + "quality", "high",
//displayC = displayC + "pluginspage", "http://www.macromedia.com/go/getflashplayer",
//displayC = displayC + "align", "middle",
//displayC = displayC + "play", "true",
//displayC = displayC + "loop", "true",
//displayC = displayC + "scale", "showall",
//displayC = displayC + "wmode", "transparent",
//displayC = displayC + "devicefont", "false",
//displayC = displayC + "id", "player",
//displayC = displayC + "bgcolor", "#ffffff",
//displayC = displayC + "name", "player",
//displayC = displayC + "menu", "true",
//displayC = displayC + "allowFullScreen", "true",
//displayC = displayC + "allowScriptAccess","sameDomain",
//displayC = displayC + "movie", "player",
//displayC = displayC + "showRating ", "false",
//displayC = displayC + "salign", "tl",
//displayC = displayC + "flashVars", "startPlay=false&volume=40&isAdvertise=false&secsToRemovePhoto=2&video="+content+"&screenShot="+content.replace(".flv",".jpg")+"&loopVideo=false&videoBufferTime=2"
//displayC = displayC + "); "
//alert(content);
//alert(content.replace('.flv','.jpg'));

			displayC = "<object id='player' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' height='350' width='425' align='middle' classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000'><param name='_cx' value='22939'/><param name='_cy' value='5953'/><param name='FlashVars' value='startPlay=false&volume=40&isAdvertise=false&secsToRemovePhoto=2&video="+content+"&screenShot="+content.replace('.flv','.jpg')+"&loopVideo=false&videoBufferTime=2'/><param name='Movie' value='singlePlayer.swf'/><param name='Src' value='singlePlayer.swf'/><param name='WMode' value='window'/><param name='Play' value='0'/><param name='Loop' value='-1'/><param name='Quality' value='High'/><param name='SAlign' value='LT'/><param name='Menu' value='0'/><param name='Base' value=''/><param name='AllowScriptAccess' value='sameDomain'/><param name='Scale' value='NoScale'/><param name='DeviceFont' value='0'/><param name='EmbedMovie' value='0'/><param name='BGColor' value=''/><param name='SWRemote' value=''/><param name='MovieData' value=''/><param name='SeamlessTabbing' value='1'/><param name='Profile' value='0'/><param name='ProfileAddress' value=''/><param name='ProfilePort' value='0'/><param name='AllowNetworking' value='all'/><param name='allowFullScreen' value='true'/><embed src='singlePlayer.swf' quality='high' wmode='window' flashvars='startPlay=false&volume=70&videoSmooth=true&isAdvertise=false&secsToRemovePhoto=2&video="+content+"&screenShot="+content.replace('.flv','.jpg')+"&loopVideo=false&videoBufferTime=2' width='425' height='350' name='player' align='middle' allowscriptaccess='sameDomain' allowFullScreen='true' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'></embed></object>";
		}
		if ( type == "gvid") {
			displayC = "<embed style='width:425px;height:350px;' id='VideoPlayback' type='application/x-shockwave-flash' src='http://video.google.com/googleplayer.swf?docId="+content+"&hl=en' flashvars=''> </embed>";
		}
		if ( type == "utvid") {
			displayC = "<embed src='http://www.youtube.com/v/"+content+"&rel=1&color1=0x5d1719&color2=0xcd311b&border=0' type='application/x-shockwave-flash' wmode='transparent' width='425' height='355'></embed>";
		}
		if ( type == "yupivid") {
			displayC = "<embed src='http://tv.yupi.gr/video/"+content+"' type='application/x-shockwave-flash' wmode='transparent' width='425' height='350'></embed>";
		}
		if ( type == "brvid") {
			displayC = "<embed src='http://www.brightcove.tv/playerswf' bgcolor='#FFFFFF' flashVars='initVideoId="+content+"&servicesURL=http://www.brightcove.tv&viewerSecureGatewayURL=https://www.brightcove.tv&cdnURL=http://admin.brightcove.com&autoStart=false' base='http://admin.brightcove.com' name='bcPlayer' width='425' height='350' allowFullScreen='true' allowScriptAccess='always' seamlesstabbing='false' type='application/x-shockwave-flash' swLiveConnect='true' pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash'></embed>";
		}
		display.innerHTML = displayC;
	}
}