$(function(){
$("#BtnLogin").click(SendLogin);
$("#BtnLogout").click(GoLogout);
$("#BtnRegister").click(GoRegister);
$("#BtnGoUserModify").click(GoUserModify);
$("#BtnAlarm").click(GoCarAlarm);
$("#BtnCarMy").click(GoCarMy);
$("#BtnCarWanted").click(GoCarWanted);
$("#BtnQuestion").click(GoQuestion);
$("#BtnPds").click(GoBoard);
$("img#BtnHome").each(function(){
$(this).click(GoList);
});
$("#BtnAddFavorite").click(function(){
window.external.AddFavorite("http://www.busmarket.co.kr" , "¢Æ [¹ö½º¸¶ÄÏ] Áß°í¹ö½º ¹«·á±¤°í, Á÷°Å·¡ ¢Æ");
});
$("#BtnAddFavoriteEn").click(function(){
window.external.AddFavorite("http://www.busmarket.co.kr/EN" , "¢Æ [BUSMARKET] S.KOREA Used Buses Export ¢Æ");
});
$("#BtnIdSearch").click(function(){
location.href="/members/findid.html";
});
$("a#BtnCarInsert").click(GoCarInsert);
$("strong#BtnCarInsert").click(GoCarInsert);
$("#SearchAll").click(GoSearch);
$("#SearchBiz").click(GoSearch);
$("#SearchOwner").click(GoSearch);
$("#SearchExpert").click(GoSearch);
$('#floatR').scrollFollower({
pageAlign:'center',
pageWidth:960,
type :'right',
topMargin:255,
minTop :10,
margin :20,
speed :500,
easing :'swing',
zindex :0
});
$("#floatL").scrollFollower({
pageAlign:'center',
pageWidth:960,
type:'left',
topMargin:255,
minTop:10,
margin:20,
speed:0,
easing:'linear',
zindex:0,
scrollable:'no'
});
$("input[type=text][holder!=''],input[type=password][holder!='']").each(function(){
if($(this).attr("id") == "id" || $(this).attr("id") == "password"){
$(this).keypress(function(e){
if(e.keyCode == 13){
$("#BtnLogin").trigger("click");
}
});
}
});
$("*[id ^= 'Btn']").css("cursor", "pointer");
});
var modeljson;
$(function(){
$.getJSON("/EN/function/getModel.asp",{ajax: 'true'}, function(j){
modeljson = j;
$("#maker").trigger("change");
});
$("#maker").change(onChangeMaker)
});
function onChangeMaker(){
var options = '';
if($(this).val() == ""){
options = "";
}else{
options = "";
for (var i = 0; i < modeljson[$(this).val()-1].Model.length; i++) {
options += '';
}
}
$("#model").html(options);
$("#model").val("").attr("selected", "selected");
}
function SendLogin(){
if($.trim($("#id").val()) == "" || $.trim($("#id").val()) == $("#id").attr("holder")){
alert("»ç¿ëÀÚ ¾ÆÀ̵ð(ID)¸¦ ÀÔ·ÂÇÏ¿© ÁֽʽÿÀ.");$("#id").focus();return;
}
if($.trim($("#password").val()) == "" || $.trim($("#password").val()) == $("#password").attr("holder")){
alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇÏ¿© ÁֽʽÿÀ.");$("#password").focus();return;
}
$("#frmLogin").submit();
}
function GoCarInsert(){
location.href = "/Car_Insert_3.html";
}
function GoLogout(){
location.href = "/Members/Logout.asp";
}
function GoRegister(){
location.href = "/Members/Register.html";
}
function GoQuestion(){
location.href = "/Board/Estimate_Register_3.html?code=1";
}
function GoCarAlarm(){
location.href = "/Car_Alarm.html";
}
function GoCarWanted(){
location.href = "/Index.html?wantedcar=1";
}
function GoCarMy(){
location.href = "/Index.html?mycar=1";
}
function GoList(){
location.href = "/index.html";
}
function GoBoard(){
location.href = "/Board/List.html";
}
function GoBack(){
history.back();
}
function GoUserModify(){
location.href = "/Members/Modify.html";
}
function GoSearch(){
switch(this.id){
case "SearchAll":
break;
case "SearchBiz":
break;
case "SearchOwner":
break;
case "SearchExpert":
break;
}
location.href = "/EN/Index.html?SearchType=" + this.id.replace("Search", "");
}
function number_check()
{
var txt = window.event.keyCode
// 13 : Enter, 8 : Backspace, 9 : Tab, 46 : DEL
// Å°Æеå : 12, 45, 33~40
if((txt >= 48 && txt <=57) || (txt >= 96 && txt <=105) || txt == 13 || txt == 9 || txt == 8 || txt == 12 || txt == 45 || (txt >= 33 && txt <= 40) || txt == 46){
window.event.returnValue = true;
}else{
window.event.returnValue = false;
}
}
function Resize_Image(url, width, height, target)
{
var mainimage = new ImageLoader(url);
mainimage.loadEvent = function(url, image){
imgwidth = image.width;
imgheight = image.height;
{
// °¡·Î¿Í ¼¼·Î Áß ¾î´À°É ±âÁØÀ¸·Î ÁÙÀÏÁö °áÁ¤
var baseAxis;
if ( (imgwidth / width) > (imgheight / height) )
baseAxis = 'width';
else
baseAxis = 'height';
// °áÁ¤µÈ ±âÁØÀ» ¹ÙÅÁÀ¸·Î ³ª¸ÓÁö ±æÀ̸¦ ¸®»çÀÌ¡
if (baseAxis == 'width') {
height = Math.round(imgheight * (width / imgwidth));
} else { // baseAxis == 'height'
width = Math.round(imgwidth * (height / imgheight));
}
//$(target).attr("src", $(mainimage).attr("src"));
$(target).attr("src", image.src);
$(target).attr("width", width);
$(target).attr("height", height);
}
}
if(url != "")
{
mainimage.load();
}
}
/**
* A simple JavaScript image loaderimage loader
* @author Cuong Tham
* @url http://thecodecentral.com/2008/02/21/a-useful-javascript-image-loader
* @usage
* var loader = new ImageLoader('IMAGE_URL');
* //set event handler
* loader.loadEvent = function(url, image){
* //action to perform when the image is loaded
* document.body.appendChild(image);
* }
* loader.load();
*/
//source: http://snipplr.com/view.php?codeview&id=561
// Cross-browser implementation of element.addEventListener()
function addListener(element, type, expression, bubbling)
{
bubbling = bubbling || false;
if(window.addEventListener) { // Standard
element.addEventListener(type, expression, bubbling);
return true;
} else if(window.attachEvent) { // IE
element.attachEvent('on' + type, expression);
return true;
} else return false;
}
var ImageLoader = function(url){
this.url = url;
this.image = null;
this.loadEvent = null;
};
ImageLoader.prototype = {
load:function(){
this.image = document.createElement('img');
var url = this.url;
var image = this.image;
var loadEvent = this.loadEvent;
addListener(this.image, 'load', function(e){
if(loadEvent != null){
loadEvent(url, image);
}
}, false);
this.image.src = this.url;
},
getImage:function(){
return this.image;
}
};