
function ChangeUrl(url) {
	if (url != "") {
		window.location.href = url;
	}
}

function SetFocus(elementId){
    var elmnt = document.getElementById(elementId);
    if(elmnt.focus)
        elmnt.focus();
}

function SetInputVal(inputId,val){
    document.getElementById(inputId).value = val;
}

function WriteImage(elementId,imgSrc) {
    writeInnerCode(elementId, "<img src='"+imgSrc+"' border='0' alt='' />");
    return false;
}

function ChangeImgSrc(imgId,newSrc){
    document.getElementById(imgId).src = newSrc;
}

function FullWin(targeturl){
    var w = screen.width - 50;
    var h = screen.height - 100;
    
    myleft=(screen.width)?(screen.width-w)/2:100;
    mytop=10;
    window.open(targeturl,"","width="+ w +",height="+ h +",left="+myleft+",top="+mytop+",toolbar=no,scrollbars=no,statusbar=no");
}

function OCAccessories(menuId){
    var displayMode = GetDisplayMode();
    var menuImg = document.getElementById("img"+menuId);
    
	if (document.getElementById(menuId).style.display == displayMode)
	{
		document.getElementById(menuId).style.display = "none";
		menuImg.src = "images/aroc_btn_open_02.jpg";
	}
	else if (document.getElementById(menuId).style.display == "none")
	{
		document.getElementById(menuId).style.display = displayMode;
		menuImg.src = "images/aroc_btn_close_02.jpg";
	}
}




/*
    TSupport
*/
function ShowAnswer(answId){

    var displayMode = GetDisplayMode();
    var answBox = "answerBox_" + answId;
    var cntrBox = "controlBox_" + answId;
    
	if (document.getElementById(answBox).style.display == displayMode)
	{
		document.getElementById(answBox).style.display = "none";
		writeInnerCode(cntrBox,"<a href=\"#\" onclick=\"ShowAnswer('" + answId + "');return false;\">Cevap <img src=\"images/aroc_btn_open.jpg\" border=\"0\" alt=\"\" align=\"absmiddle\"/></a>");
	}
	else if (document.getElementById(answBox).style.display == "none")
	{
		document.getElementById(answBox).style.display = displayMode;
		writeInnerCode(cntrBox,"<a href=\"#\" onclick=\"ShowAnswer('" + answId + "');return false;\">Kapat <img src=\"images/aroc_btn_close.jpg\" border=\"0\" alt=\"\" align=\"absmiddle\"/></a>");
	}
}

/*
    Gallery
*/
function ClearGalleryForm(){
    SetInputVal("postFile","");
    SetInputVal("postMsg","");     
}


/*
    eCard
*/
function ClearECardForm(){
    SetInputVal("postMsg","");
    SetInputVal("postMail","");     
}

/*
    doLogin
*/
function doLogin(user,pass){
    document.getElementById("postUser").value = user;
    document.getElementById("postPass").value = pass;
    document.getElementById("lgnForm").submit();
}


/*
    Basic Ajax Base - Syntax
*/
function CallRequest(container,url)
{
    writeInnerCode(container, "<div style='color:White;'>Yükleniyor..</div>");

    var xmlHttpObject = CrXMLHTTP();

    try{
      if(xmlHttpObject)
      {
	        xmlHttpObject.open("GET",url,true);
	        xmlHttpObject.onreadystatechange=function()
	        {
		        if(xmlHttpObject.readyState==4) 
		        {
		            writeInnerCode(container, xmlHttpObject.responseText);
		        }
	        };
	        xmlHttpObject.setRequestHeader('Content-type', 'application/x-www-form-urlencoded;charset=iso-8859-9');
	        xmlHttpObject.setRequestHeader('Content-type', 'application/x-www-form-urlencoded;language=tr');
	        xmlHttpObject.send(null);
      }
    }catch(myErr){
        alert(myErr.message);
    }
}

function CallRequestWithTemplate(container, url, code)
{
    writeInnerCode(container, code);

    var xmlHttpObject = CrXMLHTTP();

    try{
      if(xmlHttpObject)
      {
	        xmlHttpObject.open("GET",url,true);
	        xmlHttpObject.onreadystatechange=function()
	        {
		        if(xmlHttpObject.readyState==4) 
		        {
		            writeInnerCode(container, xmlHttpObject.responseText);
		        }
	        };
	        xmlHttpObject.setRequestHeader('Content-type', 'application/x-www-form-urlencoded;charset=iso-8859-9');
	        xmlHttpObject.setRequestHeader('Content-type', 'application/x-www-form-urlencoded;language=tr');
	        xmlHttpObject.send(null);
      }
    }catch(myErr){
        alert(myErr.message);
    }
}

function CrXMLHTTP()
{
    var retval=null;
    try
    {
	    retval=new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch(e)
    {
	    try
	    {
		    retval=new ActiveXObject("Microsoft.XMLHTTP");
	    } 
	    catch(oc)
	    {
		    retval=null;
	    }
    }
    if(!retval && typeof XMLHttpRequest != "undefined") 
    {
	    retval=new XMLHttpRequest();
	    retval.overrideMimeType("text/xml");
    }
    return retval;
}

function writeInnerCode(elementId, strCode){
    
    try{

	if(document.getElementById)
	{
		document.getElementById(elementId).innerHTML = strCode;
	}
	else if(document.all)
	{
			document.all[elementId].innerHTML = strCode;
	}
	else if(document.layers)
	{
		with(document.layers[elementId].document)
		{
			open();
			write(strCode);
			close();
		}
	}
	
	}catch(myErr){
	    alert(myErr.message);
	}
}

function GetDisplayMode(){
	var displayMode = "";
	var browserName=navigator.appName;
	if (browserName=="Netscape")
	{ 
		displayMode = "table-row";
	}
	else 
	{ 
		if (browserName=="Microsoft Internet Explorer")
		{
			displayMode = "block";
		}
		else
		{
			// nothing
		}
	}
	return displayMode;
}

function showCombo(trID)
{
    var displayMode = GetDisplayMode();

	if (document.getElementById(trID).style.display == displayMode)
	{
		document.getElementById(trID).style.display = "none";
	}
	else if (document.getElementById(trID).style.display == "none")
	{
		document.getElementById(trID).style.display = displayMode;
	}
}

function OpenBrWindow(theURL,winName,features, myWidth, myHeight, isCenter) {
	if(window.screen)
		if(isCenter)
			if(isCenter=="true"){
				var myLeft = (screen.width-myWidth)/2;
				var myTop = (screen.height-myHeight)/2;
				features+=(features!='')?',':'';
				features+=',left='+myLeft+',top='+myTop;
			}
	var strwinName = window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
	strwinName.focus();
}