//Function to change page from option list
function linkURL(URL) {
	
	if (URL.options[URL.selectedIndex].value != "") self.location.href = URL.options[URL.selectedIndex].value;	
	return true;
}

//Function to open pop up window
function winOpener(theURL, winName, scrollbars, resizable, width, height) {
	
	winFeatures = 'left=' + (screen.availWidth-10-width)/2 + ',top=' + (screen.availHeight-30-height)/2 + ',scrollbars=' + scrollbars + ',resizable=' + resizable + ',width=' + width + ',height=' + height + ',toolbar=0,location=0,status=1,menubar=0'
  	window.open(theURL, winName, winFeatures);
}
// Resim yeniden  boyutlandırma
function ResizeImages(){
    if(document.images.length > 0){
        var intImgHeight = 0, intImgWidth = 0, intForCounter = 0;
        for(intForCounter; intForCounter < document.images.length; intForCounter++){
            intImgWidth = document.images[intForCounter].width;
            if(intImgWidth > 690){
                intImgHeight = document.images[intForCounter].height;
                document.images[intForCounter].width = 640;
                document.images[intForCounter].height = (intImgHeight / (intImgWidth / 640));
            }
        }
    }
}


//Show drop down
function showDropDown(parentEle, dropDownEle, dropDownWidth, offSetRight){
	
	parentElement = document.getElementById(parentEle);
	dropDownElement = document.getElementById(dropDownEle)
	
	//position
	dropDownElement.style.left = (getOffsetLeft(parentElement) - offSetRight) + 'px';
	dropDownElement.style.top = (getOffsetTop(parentElement) + parentElement.offsetHeight + 3) + 'px';
	
	//width
	dropDownElement.style.width = dropDownWidth + 'px';

	//display
	hideDropDown();
	dropDownElement.style.visibility = 'visible';
	
	
	//Event Listener to hide drop down
	if(document.addEventListener){ // Mozilla, Netscape, Firefox
		document.addEventListener('mouseup', hideDropDown, false);
	} else { // IE
		document.onmouseup = hideDropDown;
	}
}

//Hide drop downs
function hideDropDown(){
	hide('div');
	hide('iframe');
	function hide(tag){
		var classElements = new Array();
		var els = document.getElementsByTagName(tag);
		var elsLen = els.length;
		var pattern = new RegExp('(^|\\s)dropDown(.*\)');
		
		for (i = 0, j = 0; i < elsLen; i++) {
			if ( pattern.test(els[i].className) ) {
				els[i].style.visibility='hidden';
				j++;
			}
		}
	}	
}
